Merge branch 'main' into CURA-11364_add_sentry_engine

This commit is contained in:
Casper Lamboo 2023-11-30 09:29:47 +01:00 committed by GitHub
commit 1dc350012d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
113 changed files with 2283 additions and 7199 deletions

View file

@ -25,7 +25,7 @@ class CuraConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
# FIXME: Remove specific branch once merged to main
python_requires = "translationextractor/[>=2.1.1]@ultimaker/stable"
python_requires = "translationextractor/[>=2.2.0]@ultimaker/stable"
options = {
"enterprise": ["True", "False", "true", "false"], # Workaround for GH Action passing boolean as lowercase string
@ -52,6 +52,10 @@ class CuraConan(ConanFile):
if not self.version:
self.version = "5.7.0-alpha"
@property
def _i18n_options(self):
return self.conf.get("user.i18n:options", default = {"extract": True, "build": True}, check_type = dict)
@property
def _pycharm_targets(self):
return self.conan_data["pycharm_targets"]
@ -257,7 +261,7 @@ class CuraConan(ConanFile):
with open(os.path.join(self.recipe_folder, "UltiMaker-Cura.spec.jinja"), "r") as f:
pyinstaller = Template(f.read())
version = self.conf_info.get("user.cura:version", default = self.version, check_type = str)
version = self.conf.get("user.cura:version", default = self.version, check_type = str)
cura_version = Version(version)
with open(os.path.join(location, "UltiMaker-Cura.spec"), "w") as f:
@ -310,7 +314,7 @@ class CuraConan(ConanFile):
self.options["curaengine"].enable_sentry = True
def validate(self):
version = self.conf_info.get("user.cura:version", default = self.version, check_type = str)
version = self.conf.get("user.cura:version", default = self.version, check_type = str)
if version and Version(version) <= Version("4"):
raise ConanInvalidConfiguration("Only versions 5+ are support")
@ -321,7 +325,7 @@ class CuraConan(ConanFile):
self.requires("zlib/1.2.13")
self.requires("pyarcus/5.3.0")
self.requires("dulcificum/0.1.0-beta.1")
self.requires("curaengine/(latest)@ultimaker/cura_11364")
self.requires("curaengine/(latest)@ultimaker/testing")
self.requires("pysavitar/5.3.0")
self.requires("pynest2d/5.3.0")
self.requires("curaengine_plugin_gradual_flow/0.1.0")
@ -336,7 +340,7 @@ class CuraConan(ConanFile):
def build_requirements(self):
if self.options.get_safe("enable_i18n", False):
self.tool_requires("gettext/0.21@ultimaker/testing", force_host_context = True)
self.tool_requires("gettext/0.21", force_host_context = True)
def layout(self):
self.folders.source = "."
@ -398,12 +402,18 @@ class CuraConan(ConanFile):
if self.options.devtools:
entitlements_file = "'{}'".format(os.path.join(self.source_folder, "packaging", "MacOS", "cura.entitlements"))
self._generate_pyinstaller_spec(location = self.generators_folder,
entrypoint_location = "'{}'".format(os.path.join(self.source_folder, self.conan_data["pyinstaller"]["runinfo"]["entrypoint"])).replace("\\", "\\\\"),
icon_path = "'{}'".format(os.path.join(self.source_folder, "packaging", self.conan_data["pyinstaller"]["icon"][str(self.settings.os)])).replace("\\", "\\\\"),
entitlements_file = entitlements_file if self.settings.os == "Macos" else "None")
self._generate_pyinstaller_spec(
location=self.generators_folder,
entrypoint_location="'{}'".format(
os.path.join(self.source_folder, self.conan_data["pyinstaller"]["runinfo"]["entrypoint"])).replace(
"\\", "\\\\"),
icon_path="'{}'".format(os.path.join(self.source_folder, "packaging",
self.conan_data["pyinstaller"]["icon"][
str(self.settings.os)])).replace("\\", "\\\\"),
entitlements_file=entitlements_file if self.settings.os == "Macos" else "None"
)
if self.options.get_safe("enable_i18n", False):
if self.options.get_safe("enable_i18n", False) and self._i18n_options["extract"]:
# Update the po and pot files
vb = VirtualBuildEnv(self)
vb.generate()
@ -414,7 +424,7 @@ class CuraConan(ConanFile):
pot.generate()
def build(self):
if self.options.get_safe("enable_i18n", False):
if self.options.get_safe("enable_i18n", False) and self._i18n_options["build"]:
for po_file in self.source_path.joinpath("resources", "i18n").glob("**/*.po"):
mo_file = Path(self.build_folder, po_file.with_suffix('.mo').relative_to(self.source_path))
mo_file = mo_file.parent.joinpath("LC_MESSAGES", mo_file.name)
@ -438,7 +448,7 @@ class CuraConan(ConanFile):
copy(self, "*", uranium.libdirs[0], str(self._site_packages.joinpath("UM")), keep_path = True)
# Generate the GitHub Action version info Environment
version = self.conf_info.get("user.cura:version", default = self.version, check_type = str)
version = self.conf.get("user.cura:version", default = self.version, check_type = str)
cura_version = Version(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