test.pythoninfo logs freedesktop_os_release() (#109057)
This commit is contained in:
parent
e7d5433f94
commit
babdced23f
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user