Skip to content

Commit

Permalink
Merge pull request #4507 from timsu92/fix/windows_systeminfo_codepage
Browse files Browse the repository at this point in the history
Fix windows systeminfo codepage when setting up
  • Loading branch information
totaam authored Feb 15, 2025
2 parents c116823 + 42f434c commit a397227
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions fs/bin/add_build_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packaging/MSWindows/SETUP.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a397227

Please sign in to comment.