Skip to content

Commit 0f2f411

Browse files
committed
__main__: add Platform block to --version output
The --version dump is what we ask users for when triaging crashes, so it should carry enough host info to tell macOS-on-Apple-Silicon apart from Windows-on-AMD64 without a follow-up question. Adds a Platform section with system, kernel, arch, Python implementation, the interpreter path, the openage install path, and the glibc version on Linux. All stdlib, no new deps. Also moves the "== C++ ==" header out of LONGVERSION so it can be printed conditionally, and falls back to a clear "Cython module not built" line when openage.versions hasn't been compiled yet (e.g. when running --version from a partially configured tree). OpenGL version is still TODO; it needs a live GL context, which we don't want to spin up just to satisfy --version. Left as a follow-up. Refs #1185.
1 parent db97138 commit 0f2f411

2 files changed

Lines changed: 28 additions & 9 deletions

File tree

openage/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2013-2023 the openage authors. See copying.md for legal info.
1+
# Copyright 2013-2026 the openage authors. See copying.md for legal info.
22

33
"""
44
The Python part of openage, a free engine re-write of
@@ -41,9 +41,7 @@
4141
f"Mako {config.MAKOVERSION}\n"
4242
f"NumPy {config.NUMPYVERSION}\n"
4343
f"Pillow {config.PILVERSION}\n"
44-
f"Pygments {config.PYGMENTSVERSION}\n"
45-
"\n"
46-
"== C++ =="
44+
f"Pygments {config.PYGMENTSVERSION}"
4745
)
4846

4947

openage/__main__.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2015-2024 the openage authors. See copying.md for legal info.
1+
# Copyright 2015-2026 the openage authors. See copying.md for legal info.
22
#
33
# pylint: disable=too-many-statements
44
"""
@@ -22,12 +22,33 @@ def print_version():
2222
The default version printer, unfortunately, inserts newlines.
2323
This is the easiest way around.
2424
"""
25+
import platform
26+
2527
from . import LONGVERSION
2628
print(LONGVERSION)
27-
from .versions.versions import get_version_numbers
28-
version_numbers = get_version_numbers()
29-
for key in version_numbers:
30-
print(key.decode("utf8") + " " + version_numbers[key].decode("utf8"))
29+
30+
print()
31+
print("== Platform ==")
32+
print(f"System {platform.system()} {platform.release()}")
33+
print(f"Version {platform.version()}")
34+
print(f"Architecture {platform.machine()}")
35+
print(f"Python impl {platform.python_implementation()} {platform.python_version()}")
36+
print(f"Executable {sys.executable}")
37+
print(f"openage path {os.path.dirname(os.path.realpath(__file__))}")
38+
libc_lib, libc_ver = platform.libc_ver()
39+
if libc_lib:
40+
print(f"libc (probe) {libc_lib} {libc_ver}")
41+
42+
print()
43+
print("== C++ ==")
44+
try:
45+
from .versions.versions import get_version_numbers
46+
except ImportError:
47+
print("(unavailable; openage.versions Cython module not built)")
48+
else:
49+
version_numbers = get_version_numbers()
50+
for key in version_numbers:
51+
print(key.decode("utf8") + " " + version_numbers[key].decode("utf8"))
3152
sys.exit(0)
3253

3354

0 commit comments

Comments
 (0)