diff --git a/fs/bin/add_build_info.py b/fs/bin/add_build_info.py index 4e9ba02fe6..db9de664c5 100755 --- a/fs/bin/add_build_info.py +++ b/fs/bin/add_build_info.py @@ -9,13 +9,12 @@ import datetime from shutil import which -from subprocess import Popen, PIPE, STDOUT, getstatusoutput +from subprocess import Popen, PIPE, STDOUT, getstatusoutput, run from typing import Any from collections.abc import Sequence import socket import platform import os.path -import re import sys @@ -171,11 +170,18 @@ def get_platform_name() -> str: return "OpenBSD" if sys.platform.startswith("win"): try: - out = Popen('systeminfo', stdout=PIPE, text=True).communicate()[0] - match = re.search(r"OS Name:\s*(.*)", out) - if match: - return match.group(1).strip() - return "Windows unknown" + out = run( + [ + "powershell", + "-NoProfile", + "-Command", + "$OutputEncoding = [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding; (Get-CimInstance Win32_OperatingSystem).Caption | Out-String", + ], + capture_output=True, + text=True, + encoding="utf-8", + ).stdout.strip() + return out except OSError: pass return "Microsoft Windows" diff --git a/packaging/MSWindows/SETUP.sh b/packaging/MSWindows/SETUP.sh index 6773c882e2..a7d37269ba 100644 --- a/packaging/MSWindows/SETUP.sh +++ b/packaging/MSWindows/SETUP.sh @@ -30,7 +30,7 @@ for x in cryptography cffi pycparser numpy pillow appdirs paramiko comtypes neti $PACMAN ${XPKG}python-${x} done #not yet available for aarch64?: -for x in cx-Freeze gssapi; do +for x in cx-freeze gssapi; do $PACMAN ${XPKG}python-${x} done