Skip to content

test.pythoninfo logs freedesktop_os_release() #109057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion Lib/test/pythoninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():
Expand All @@ -929,6 +948,7 @@ def main():
dump_info(info)

if error:
print()
print("Collection failed: exit with error", file=sys.stderr)
sys.exit(1)

Expand Down