瀏覽代碼

Allow overriding `VERSION_STATUS` with `GODOT_VERSION_STATUS` in env

`VERSION_STATUS` is part of what constitutes the reference version for a given
Godot build, and is part of the version check for compatible export templates.

For dev snapshots (alpha, beta, RCs), we usually set the `VERSION_STATUS` to
a specific build number (e.g. `beta2`), but this change doesn't end up
committed to the Git repository as we don't want to keep changing `version.py`
for testing builds.

So this new environment override will be what can be used in official builds
and by users making custom builds for specific snapshots.

(cherry picked from commit 948dcb63ca4f31f12d936761cdc177a730a196fc)
Rémi Verschelde 4 年之前
父節點
當前提交
a43365bd58
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8 3
      methods.py

+ 8 - 3
methods.py

@@ -58,10 +58,9 @@ def add_module_version_string(self, s):
 
 
 
 
 def update_version(module_version_string=""):
 def update_version(module_version_string=""):
-
     build_name = "custom_build"
     build_name = "custom_build"
     if os.getenv("BUILD_NAME") != None:
     if os.getenv("BUILD_NAME") != None:
-        build_name = os.getenv("BUILD_NAME")
+        build_name = str(os.getenv("BUILD_NAME"))
         print("Using custom build name: " + build_name)
         print("Using custom build name: " + build_name)
 
 
     import version
     import version
@@ -73,7 +72,13 @@ def update_version(module_version_string=""):
     f.write("#define VERSION_MAJOR " + str(version.major) + "\n")
     f.write("#define VERSION_MAJOR " + str(version.major) + "\n")
     f.write("#define VERSION_MINOR " + str(version.minor) + "\n")
     f.write("#define VERSION_MINOR " + str(version.minor) + "\n")
     f.write("#define VERSION_PATCH " + str(version.patch) + "\n")
     f.write("#define VERSION_PATCH " + str(version.patch) + "\n")
-    f.write('#define VERSION_STATUS "' + str(version.status) + '"\n')
+    # For dev snapshots (alpha, beta, RC, etc.) we do not commit status change to Git,
+    # so this define provides a way to override it without having to modify the source.
+    godot_status = str(version.status)
+    if os.getenv("GODOT_VERSION_STATUS") != None:
+        godot_status = str(os.getenv("GODOT_VERSION_STATUS"))
+        print("Using version status '%s', overriding the original '%s'.".format(godot_status, str(version.status)))
+    f.write('#define VERSION_STATUS "' + godot_status + '"\n')
     f.write('#define VERSION_BUILD "' + str(build_name) + '"\n')
     f.write('#define VERSION_BUILD "' + str(build_name) + '"\n')
     f.write('#define VERSION_MODULE_CONFIG "' + str(version.module_config) + module_version_string + '"\n')
     f.write('#define VERSION_MODULE_CONFIG "' + str(version.module_config) + module_version_string + '"\n')
     f.write("#define VERSION_YEAR " + str(version.year) + "\n")
     f.write("#define VERSION_YEAR " + str(version.year) + "\n")