From 0f2f4115be7e1bb4c5c023342d59c5e1b7343b7f Mon Sep 17 00:00:00 2001 From: nicolassanchez02 <98576999+nicolassanchez02@users.noreply.github.com> Date: Fri, 29 May 2026 01:20:04 -0500 Subject: [PATCH] __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. --- openage/__init__.py | 6 ++---- openage/__main__.py | 31 ++++++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/openage/__init__.py b/openage/__init__.py index 8dd67eba15..eebc0b48b3 100644 --- a/openage/__init__.py +++ b/openage/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2013-2023 the openage authors. See copying.md for legal info. +# Copyright 2013-2026 the openage authors. See copying.md for legal info. """ The Python part of openage, a free engine re-write of @@ -41,9 +41,7 @@ f"Mako {config.MAKOVERSION}\n" f"NumPy {config.NUMPYVERSION}\n" f"Pillow {config.PILVERSION}\n" - f"Pygments {config.PYGMENTSVERSION}\n" - "\n" - "== C++ ==" + f"Pygments {config.PYGMENTSVERSION}" ) diff --git a/openage/__main__.py b/openage/__main__.py index 60c1c1bb4f..ea5d1b6284 100644 --- a/openage/__main__.py +++ b/openage/__main__.py @@ -1,4 +1,4 @@ -# Copyright 2015-2024 the openage authors. See copying.md for legal info. +# Copyright 2015-2026 the openage authors. See copying.md for legal info. # # pylint: disable=too-many-statements """ @@ -22,12 +22,33 @@ def print_version(): The default version printer, unfortunately, inserts newlines. This is the easiest way around. """ + import platform + from . import LONGVERSION print(LONGVERSION) - from .versions.versions import get_version_numbers - version_numbers = get_version_numbers() - for key in version_numbers: - print(key.decode("utf8") + " " + version_numbers[key].decode("utf8")) + + print() + print("== Platform ==") + print(f"System {platform.system()} {platform.release()}") + print(f"Version {platform.version()}") + print(f"Architecture {platform.machine()}") + print(f"Python impl {platform.python_implementation()} {platform.python_version()}") + print(f"Executable {sys.executable}") + print(f"openage path {os.path.dirname(os.path.realpath(__file__))}") + libc_lib, libc_ver = platform.libc_ver() + if libc_lib: + print(f"libc (probe) {libc_lib} {libc_ver}") + + print() + print("== C++ ==") + try: + from .versions.versions import get_version_numbers + except ImportError: + print("(unavailable; openage.versions Cython module not built)") + else: + version_numbers = get_version_numbers() + for key in version_numbers: + print(key.decode("utf8") + " " + version_numbers[key].decode("utf8")) sys.exit(0)