Allow using lower case true, false options

Workaround for Github Actions passing a lowercase boolean as a string

Contributes to CURA-9365
This commit is contained in:
j.spijker@ultimaker.com 2022-06-12 23:54:50 +02:00 committed by Jelle Spijker
parent 2cab988c63
commit 8d7732353f

View file

@ -26,18 +26,16 @@ class CuraConan(ConanFile):
generators = "VirtualPythonEnv" generators = "VirtualPythonEnv"
options = { options = {
"python_version": "ANY", "python_version": "ANY",
"enterprise": [True, False], "enterprise": ["True", "False", "true", "false"],
"staging": [True, False], "staging": ["True", "False", "true", "false"],
"external_engine": [True, False],
"devtools": [True, False], "devtools": [True, False],
"cloud_api_version": "ANY", "cloud_api_version": "ANY",
"display_name": "ANY" "display_name": "ANY"
} }
default_options = { default_options = {
"python_version": "system", "python_version": "system",
"enterprise": False, "enterprise": "False",
"staging": False, "staging": "False",
"external_engine": False,
"devtools": False, "devtools": False,
"cloud_api_version": "1", "cloud_api_version": "1",
"display_name": "Ultimaker Cura" "display_name": "Ultimaker Cura"
@ -56,21 +54,29 @@ class CuraConan(ConanFile):
else: else:
self.version = "main" self.version = "main"
@property
def _staging(self):
return self.options.staging in ["True", 'true']
@property
def _enterprise(self):
return self.options.enterprise in ["True", 'true']
@property @property
def _cloud_api_root(self): def _cloud_api_root(self):
return "https://api-staging.ultimaker.com" if self.options.staging else "https://api.ultimaker.com" return "https://api-staging.ultimaker.com" if self._staging else "https://api.ultimaker.com"
@property @property
def _cloud_account_api_root(self): def _cloud_account_api_root(self):
return "https://account-staging.ultimaker.com" if self.options.staging else "https://account.ultimaker.com" return "https://account-staging.ultimaker.com" if self._staging else "https://account.ultimaker.com"
@property @property
def _marketplace_root(self): def _marketplace_root(self):
return "https://marketplace-staging.ultimaker.com" if self.options.staging else "https://marketplace.ultimaker.com" return "https://marketplace-staging.ultimaker.com" if self._staging else "https://marketplace.ultimaker.com"
@property @property
def _digital_factory_url(self): def _digital_factory_url(self):
return "https://digitalfactory-staging.ultimaker.com" if self.options.staging else "https://digitalfactory.ultimaker.com" return "https://digitalfactory-staging.ultimaker.com" if self._staging else "https://digitalfactory.ultimaker.com"
@property @property
def requirements_txts(self): def requirements_txts(self):
@ -119,7 +125,7 @@ class CuraConan(ConanFile):
cura_app_name = self.name, cura_app_name = self.name,
cura_app_display_name = self.options.display_name, cura_app_display_name = self.options.display_name,
cura_version = self.version if self.version else "main", cura_version = self.version if self.version else "main",
cura_build_type = "Enterprise" if self.options.enterprise else "", cura_build_type = "Enterprise" if self._enterprise else "",
cura_debug_mode = self.settings.build_type != "Release", cura_debug_mode = self.settings.build_type != "Release",
cura_cloud_api_root = self._cloud_api_root, cura_cloud_api_root = self._cloud_api_root,
cura_cloud_api_version = self.options.cloud_api_version, cura_cloud_api_version = self.options.cloud_api_version,