diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-07 05:43:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-07 05:43:32 (GMT) |
commit | babdced23fc299b7607ac76abfdd7a81050f8359 (patch) | |
tree | 419bed63b949afe3f39ecc6c42647c529d9e4710 /Lib/test/pythoninfo.py | |
parent | e7d5433f944a5725aa82595f9251abfc8a63d333 (diff) | |
download | cpython-babdced23fc299b7607ac76abfdd7a81050f8359.zip cpython-babdced23fc299b7607ac76abfdd7a81050f8359.tar.gz cpython-babdced23fc299b7607ac76abfdd7a81050f8359.tar.bz2 |
test.pythoninfo logs freedesktop_os_release() (#109057)
Diffstat (limited to 'Lib/test/pythoninfo.py')
-rw-r--r-- | Lib/test/pythoninfo.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py index 46522b5..c628833 100644 --- a/Lib/test/pythoninfo.py +++ b/Lib/test/pythoninfo.py @@ -164,6 +164,26 @@ def collect_platform(info_add): if libc_ver: info_add('platform.libc_ver', libc_ver) + try: + os_release = platform.freedesktop_os_release() + except OSError: + pass + else: + for key in ( + 'ID', + 'NAME', + 'PRETTY_NAME' + 'VARIANT', + 'VARIANT_ID', + 'VERSION', + 'VERSION_CODENAME', + 'VERSION_ID', + ): + if key not in os_release: + continue + info_add(f'platform.freedesktop_os_release[{key}]', + os_release[key]) + def collect_locale(info_add): import locale @@ -920,7 +940,6 @@ def dump_info(info, file=None): for key, value in infos: value = value.replace("\n", " ") print("%s: %s" % (key, value)) - print() def main(): @@ -929,6 +948,7 @@ def main(): dump_info(info) if error: + print() print("Collection failed: exit with error", file=sys.stderr) sys.exit(1) |