Set version number for CuraVersion.py

If you want custom version use the Conan Configuration:
`user.cura:version`

Contributes to CURA-9711
This commit is contained in:
jelle spijker 2022-10-05 14:32:54 +02:00 committed by jspijker
parent 728daec6af
commit 67e99cd4ce

View File

@ -151,17 +151,12 @@ class CuraConan(ConanFile):
with open(Path(__file__).parent.joinpath("CuraVersion.py.jinja"), "r") as f: with open(Path(__file__).parent.joinpath("CuraVersion.py.jinja"), "r") as f:
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) # If you want a specific Cura version to show up on the splash screen add the user configuration `user.cura:version=VERSION`
version = Version(cura_version) # the global.conf, profile, package_info (of dependency) or via the cmd line `-c user.cura:version=VERSION`
prerelease = "" cura_version = Version(self.conf.get("user.cura:version", default = self.version, check_type = str))
if self.options.extra_build_version != "": pre_tag = f"-{cura_version.pre}" if cura_version.pre else ""
prerelease = self.options.extra_build_version build_tag = f"+internal_{cura_version.build}" if self.options.internal and cura_version.build else ""
if self.options.internal: cura_version = f"{cura_version.major}.{cura_version.minor}.{cura_version.patch}{pre_tag}{build_tag}"
prerelease = version.prerelease.replace('+', '+internal_')
if prerelease != "":
cura_version = f"{version.major}.{version.minor}.{version.patch}-{prerelease}"
else:
cura_version = f"{version.major}.{version.minor}.{version.patch}"
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(