Skip to content

Commit f60c855

Browse files
committed
More bugfixes
* Fix ver command * Fix kern.hv_vmm_present test * Log also IMAGE_OS_VERSION env var. * Remove debug messages
1 parent bf2f058 commit f60c855

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎Lib/test/pythoninfo.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ def format_groups(groups):
314314
"HOMEDRIVE",
315315
"HOMEPATH",
316316
"IDLESTARTUP",
317+
"IMAGE_OS_VERSION",
317318
"IPHONEOS_DEPLOYMENT_TARGET",
318319
"LANG",
319320
"LDFLAGS",
@@ -466,11 +467,9 @@ def run_command(cmd, check=True, **kwargs):
466467
return ''
467468

468469
# Strip trailing spaces and newlines
469-
print(f"DEBUG: Command {cmd_str} succeeded: {stdout!r}")
470470
stdout = stdout.rstrip()
471471
return stdout
472-
except FileNotFoundError as exc:
473-
print(f"DEBUG: Command {cmd_str} failed with: {exc!r}")
472+
except FileNotFoundError:
474473
return ''
475474
except OSError as exc:
476475
print(f"Command {cmd_str} failed with: {exc!r}")
@@ -1025,6 +1024,8 @@ def collect_windows(info_add):
10251024

10261025
# windows.ver: "ver" command
10271026
output = run_command(["ver"], shell=True)
1027+
# "ver" output starts with an empty line: remove it
1028+
output = output.strip()
10281029
if output:
10291030
first_line = output.splitlines()[0]
10301031
if first_line:
@@ -1157,7 +1158,7 @@ def detect_virt():
11571158
return container
11581159

11591160
if APPLE:
1160-
hv_vmm_present = run_command(['sysctl', 'kern.hv_vmm_present'])
1161+
hv_vmm_present = run_command(['sysctl', '-n', 'kern.hv_vmm_present'])
11611162
if hv_vmm_present == '1':
11621163
return 'run in a VM (kern.hv_vmm_present is 1)'
11631164

0 commit comments

Comments
 (0)