Able to force 'prerelease'-version information.

This commit is contained in:
Remco Burema 2022-09-23 17:49:50 +02:00
parent 31e1577347
commit a94bd91085

View file

@ -35,6 +35,7 @@ class CuraConan(ConanFile):
"devtools": [True, False], # FIXME: Split this up in testing and (development / build (pyinstaller) / system installer) tools "devtools": [True, False], # FIXME: Split this up in testing and (development / build (pyinstaller) / system installer) tools
"cloud_api_version": "ANY", "cloud_api_version": "ANY",
"display_name": "ANY", # TODO: should this be an option?? "display_name": "ANY", # TODO: should this be an option??
"extra_build_version": "ANY", #FIXME?: can't retrieve this from github workflow, so have an option to do it 'manually'
"cura_debug_mode": [True, False], # FIXME: Use profiles "cura_debug_mode": [True, False], # FIXME: Use profiles
"internal": [True, False] "internal": [True, False]
} }
@ -44,6 +45,7 @@ class CuraConan(ConanFile):
"devtools": False, "devtools": False,
"cloud_api_version": "1", "cloud_api_version": "1",
"display_name": "Ultimaker Cura", "display_name": "Ultimaker Cura",
"extra_build_version": "",
"cura_debug_mode": False, # Not yet implemented "cura_debug_mode": False, # Not yet implemented
"internal": False, "internal": False,
} }
@ -150,9 +152,12 @@ class CuraConan(ConanFile):
cura_version_py = Template(f.read()) cura_version_py = Template(f.read())
cura_version = self.conf_info.get("user.cura:version", default = self.version, check_type = str) cura_version = self.conf_info.get("user.cura:version", default = self.version, check_type = str)
version = Version(cura_version)
if self.options.extra_build_version != "":
version.prerelease = self.options.extra_build_version
if self.options.internal: if self.options.internal:
version = Version(cura_version) version.prerelease = version.prerelease.replace('+', '+internal_')
cura_version = f"{version.major}.{version.minor}.{version.patch}-{version.prerelease.replace('+', '+internal_')}" cura_version = f"{version.major}.{version.minor}.{version.patch}-{version.prerelease}"
with open(Path(location, "CuraVersion.py"), "w") as f: with open(Path(location, "CuraVersion.py"), "w") as f:
f.write(cura_version_py.render( f.write(cura_version_py.render(