mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 06:33:55 -06:00
Use umbase 0.1.7
This will now set the version by default if not defined at the cmd line to the first entry in the conandata.yml
This commit is contained in:
parent
328b32ee6b
commit
59d9bfde99
2 changed files with 16 additions and 117 deletions
26
conanfile.py
26
conanfile.py
|
@ -3,13 +3,13 @@ from pathlib import Path
|
|||
|
||||
from jinja2 import Template
|
||||
|
||||
from conans import tools
|
||||
from conan import ConanFile
|
||||
from conan.tools import files
|
||||
from conan.tools.files import copy, rmdir, save
|
||||
from conan.tools.env import VirtualRunEnv, Environment
|
||||
from conan.tools.scm import Version
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
|
||||
required_conan_version = ">=1.48.0"
|
||||
required_conan_version = ">=1.50.0"
|
||||
|
||||
|
||||
class CuraConan(ConanFile):
|
||||
|
@ -26,7 +26,7 @@ class CuraConan(ConanFile):
|
|||
|
||||
# FIXME: Remove specific branch once merged to main
|
||||
# Extending the conanfile with the UMBaseConanfile https://github.com/Ultimaker/conan-ultimaker-index/tree/CURA-9177_Fix_CI_CD/recipes/umbase
|
||||
python_requires = "umbase/0.1.5@ultimaker/testing"
|
||||
python_requires = "umbase/[>=0.1.7]@ultimaker/stable"
|
||||
python_requires_extend = "umbase.UMBaseConanfile"
|
||||
|
||||
options = {
|
||||
|
@ -135,7 +135,7 @@ class CuraConan(ConanFile):
|
|||
def _site_packages(self):
|
||||
if self.settings.os == "Windows":
|
||||
return self._base_dir.joinpath("Lib", "site-packages")
|
||||
py_version = tools.Version(self.deps_cpp_info["cpython"].version)
|
||||
py_version = Version(self.deps_cpp_info["cpython"].version)
|
||||
return self._base_dir.joinpath("lib", f"python{py_version.major}.{py_version.minor}", "site-packages")
|
||||
|
||||
@property
|
||||
|
@ -151,7 +151,7 @@ class CuraConan(ConanFile):
|
|||
|
||||
cura_version = self.version
|
||||
if self.options.internal:
|
||||
version = tools.Version(self.version)
|
||||
version = Version(self.version)
|
||||
cura_version = f"{version.major}.{version.minor}.{version.patch}-{version.prerelease.replace('+', '+internal_')}"
|
||||
|
||||
with open(Path(location, "CuraVersion.py"), "w") as f:
|
||||
|
@ -220,7 +220,7 @@ class CuraConan(ConanFile):
|
|||
with open(Path(__file__).parent.joinpath("Ultimaker-Cura.spec.jinja"), "r") as f:
|
||||
pyinstaller = Template(f.read())
|
||||
|
||||
cura_version = tools.Version(self.version) if self.version else tools.Version("0.0.0")
|
||||
cura_version = Version(self.version) if self.version else Version("0.0.0")
|
||||
|
||||
with open(Path(location, "Ultimaker-Cura.spec"), "w") as f:
|
||||
f.write(pyinstaller.render(
|
||||
|
@ -243,6 +243,10 @@ class CuraConan(ConanFile):
|
|||
short_version = f"'{cura_version.major}.{cura_version.minor}.{cura_version.patch}'",
|
||||
))
|
||||
|
||||
def set_version(self):
|
||||
if self.version is None:
|
||||
self.version = self._umdefault_version()
|
||||
|
||||
def configure(self):
|
||||
self.options["pyarcus"].shared = True
|
||||
self.options["pysavitar"].shared = True
|
||||
|
@ -250,7 +254,7 @@ class CuraConan(ConanFile):
|
|||
self.options["cpython"].shared = True
|
||||
|
||||
def validate(self):
|
||||
if self.version and tools.Version(self.version) <= tools.Version("4"):
|
||||
if self.version and Version(self.version) <= Version("4"):
|
||||
raise ConanInvalidConfiguration("Only versions 5+ are support")
|
||||
|
||||
def requirements(self):
|
||||
|
@ -293,7 +297,7 @@ class CuraConan(ConanFile):
|
|||
self.copy("CuraEngine.exe", root_package = "curaengine", src = "@bindirs", dst = "", keep_path = False)
|
||||
self.copy("CuraEngine", root_package = "curaengine", src = "@bindirs", dst = "", keep_path = False)
|
||||
|
||||
files.rmdir(self, "resources/materials")
|
||||
rmdir(self, os.path.join(self.source_folder, "resources", "materials"))
|
||||
self.copy("*.fdm_material", root_package = "fdm_materials", src = "@resdirs", dst = "resources/materials", keep_path = False)
|
||||
self.copy("*.sig", root_package = "fdm_materials", src = "@resdirs", dst = "resources/materials", keep_path = False)
|
||||
|
||||
|
@ -377,7 +381,7 @@ class CuraConan(ConanFile):
|
|||
self.copy("*.txt", src = self.cpp_info.resdirs[-1], dst = self._base_dir.joinpath("pip_requirements"))
|
||||
|
||||
# Generate the GitHub Action version info Environment
|
||||
cura_version = tools.Version(self.version)
|
||||
cura_version = Version(self.version)
|
||||
env_prefix = "Env:" if self.settings.os == "Windows" else ""
|
||||
activate_github_actions_version_env = Template(r"""echo "CURA_VERSION_MAJOR={{ cura_version_major }}" >> ${{ env_prefix }}GITHUB_ENV
|
||||
echo "CURA_VERSION_MINOR={{ cura_version_minor }}" >> ${{ env_prefix }}GITHUB_ENV
|
||||
|
@ -392,7 +396,7 @@ echo "CURA_VERSION_FULL={{ cura_version_full }}" >> ${{ env_prefix }}GITHUB_ENV
|
|||
env_prefix = env_prefix)
|
||||
|
||||
ext = ".sh" if self.settings.os != "Windows" else ".ps1"
|
||||
files.save(self, self._script_dir.joinpath(f"activate_github_actions_version_env{ext}"), activate_github_actions_version_env)
|
||||
save(self, self._script_dir.joinpath(f"activate_github_actions_version_env{ext}"), activate_github_actions_version_env)
|
||||
|
||||
self._generate_cura_version(Path(self._site_packages, "cura"))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue