diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-27 21:22:40 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-27 21:22:40 +0100 |
commit | 1aa8e91d158c105d69f5ebae2b7fb9efc4478c57 (patch) | |
tree | 6543c9905ff87d12fcd2059e05f98c1491ab966c /methods.py | |
parent | f5dbbf7fd067bbb435989a6839fe37e03e4ba057 (diff) | |
parent | 67e9ccdbc4909b975099ea73fc5ca92a28ce1e6a (diff) | |
download | redot-engine-1aa8e91d158c105d69f5ebae2b7fb9efc4478c57.tar.gz |
Merge pull request #59247 from Calinou/editor-display-build-date
Display the build date in the editor and when starting the engine
Diffstat (limited to 'methods.py')
-rw-r--r-- | methods.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/methods.py b/methods.py index 69d8df1d72..c85e6825da 100644 --- a/methods.py +++ b/methods.py @@ -209,6 +209,18 @@ def get_version_info(module_version_string="", silent=False): githash = head version_info["git_hash"] = githash + # Fallback to 0 as a timestamp (will be treated as "unknown" in the engine). + version_info["git_timestamp"] = 0 + + # Get the UNIX timestamp of the build commit. + if os.path.exists(".git"): + try: + version_info["git_timestamp"] = subprocess.check_output( + ["git", "log", "-1", "--pretty=format:%ct", githash] + ).decode("utf-8") + except (subprocess.CalledProcessError, OSError): + # `git` not found in PATH. + pass return version_info @@ -246,6 +258,7 @@ def generate_version_header(module_version_string=""): """/* THIS FILE IS GENERATED DO NOT EDIT */ #include "core/version.h" const char *const VERSION_HASH = "{git_hash}"; +const uint64_t VERSION_TIMESTAMP = {git_timestamp}; """.format( **version_info ) |