Workaround `libc_ver` not be available on Windows Store version of Python

pull/4977/head
pukkandan 2 years ago
parent 9665f15a96
commit dab284f80f
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39

@ -1966,13 +1966,16 @@ def system_identifier():
python_implementation = platform.python_implementation() python_implementation = platform.python_implementation()
if python_implementation == 'PyPy' and hasattr(sys, 'pypy_version_info'): if python_implementation == 'PyPy' and hasattr(sys, 'pypy_version_info'):
python_implementation += ' version %d.%d.%d' % sys.pypy_version_info[:3] python_implementation += ' version %d.%d.%d' % sys.pypy_version_info[:3]
libc_ver = []
with contextlib.suppress(OSError): # We may not have access to the executable
libc_ver = platform.libc_ver()
return 'Python %s (%s %s) - %s %s' % ( return 'Python %s (%s %s) - %s %s' % (
platform.python_version(), platform.python_version(),
python_implementation, python_implementation,
platform.architecture()[0], platform.architecture()[0],
platform.platform(), platform.platform(),
format_field(join_nonempty(*platform.libc_ver(), delim=' '), None, '(%s)'), format_field(join_nonempty(*libc_ver, delim=' '), None, '(%s)'),
) )

Loading…
Cancel
Save