summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-09-08 13:20:05 (GMT)
committerGitHub <noreply@github.com>2023-09-08 13:20:05 (GMT)
commit8c9f5f714e1126a3610194196fdd03d156b73dbd (patch)
tree8a964411d648abaa34d3b08c97af7ce2e58e84d0 /Lib/test
parent2979cee1af755eac6eab02acbe7d90048ba011f4 (diff)
downloadcpython-8c9f5f714e1126a3610194196fdd03d156b73dbd.zip
cpython-8c9f5f714e1126a3610194196fdd03d156b73dbd.tar.gz
cpython-8c9f5f714e1126a3610194196fdd03d156b73dbd.tar.bz2
[3.12] test.pythoninfo logs freedesktop_os_release() (GH-109057) (#109064)
test.pythoninfo logs freedesktop_os_release() (GH-109057) (cherry picked from commit babdced23fc299b7607ac76abfdd7a81050f8359) Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/pythoninfo.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py
index 1f75f66..8d7fb9f 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
@@ -913,7 +933,6 @@ def dump_info(info, file=None):
for key, value in infos:
value = value.replace("\n", " ")
print("%s: %s" % (key, value))
- print()
def main():
@@ -922,6 +941,7 @@ def main():
dump_info(info)
if error:
+ print()
print("Collection failed: exit with error", file=sys.stderr)
sys.exit(1)