Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-45382: test.pythoninfo logs more Windows versions #30817

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 2 commits into from
Jan 23, 2022
Merged
Changes from 1 commit
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
Next Next commit
bpo-45382: test.pythoninfo logs more Windows versions
Add the following info to test.pythoninfo:

* windows.ver: output of the shell "ver" command
* windows.version and windows.version_caption: output of the
  "wmic os get Caption,Version /value" command.
  • Loading branch information
vstinner committed Jan 23, 2022
commit d516fc712514330a1365869b4a749573c46a64a3
36 changes: 36 additions & 0 deletions 36 Lib/test/pythoninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,42 @@ def collect_windows(info_add):
except (ImportError, AttributeError):
pass

import subprocess
try:
proc = subprocess.Popen(["wmic", "os", "get", "Caption,Version", "/value"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True)
output, stderr = proc.communicate()
if proc.returncode:
output = ""
except OSError:
pass
else:
for line in output.splitlines():
line = line.strip()
if line.startswith('Caption='):
line = line.removeprefix('Caption=')
info_add('windows.version_caption', line.strip())
elif line.startswith('Version='):
line = line.removeprefix('Version=')
info_add('windows.version', line.strip())

try:
proc = subprocess.Popen(["ver"], shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True)
output = proc.communicate()[0]
if proc.returncode:
output = ""
except OSError:
return
else:
output = output.strip()
line = output.splitlines()[0]
info_add('windows.ver', line)


def collect_fips(info_add):
try:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.