mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Set the CuraVersion with the conan options
Contributes to CURA-9365
This commit is contained in:
parent
e1c384cd92
commit
5d740d7368
2 changed files with 57 additions and 3 deletions
47
conanfile.py
47
conanfile.py
|
@ -1,7 +1,10 @@
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from platform import python_version
|
from platform import python_version
|
||||||
|
|
||||||
|
from jinja2 import Template
|
||||||
|
|
||||||
from conan import ConanFile
|
from conan import ConanFile
|
||||||
from conans import tools
|
from conans import tools
|
||||||
from conan.errors import ConanInvalidConfiguration
|
from conan.errors import ConanInvalidConfiguration
|
||||||
|
@ -26,14 +29,18 @@ class CuraConan(ConanFile):
|
||||||
"enterprise": [True, False],
|
"enterprise": [True, False],
|
||||||
"staging": [True, False],
|
"staging": [True, False],
|
||||||
"external_engine": [True, False],
|
"external_engine": [True, False],
|
||||||
"devtools": [True, False]
|
"devtools": [True, False],
|
||||||
|
"cloud_api_version": "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,
|
"external_engine": False,
|
||||||
"devtools": False
|
"devtools": False,
|
||||||
|
"cloud_api_version": "1",
|
||||||
|
"display_name": "Ultimaker Cura"
|
||||||
}
|
}
|
||||||
scm = {
|
scm = {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -42,6 +49,26 @@ class CuraConan(ConanFile):
|
||||||
"revision": "auto"
|
"revision": "auto"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def set_version(self):
|
||||||
|
if not self.version and "CURA_VERSION" in os.environ:
|
||||||
|
self.version = os.environ["CURA_VERSION"]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _cloud_api_root(self):
|
||||||
|
return "https://api-staging.ultimaker.com" if self.options.staging else "https://api.ultimaker.com"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _cloud_account_api_root(self):
|
||||||
|
return "https://account-staging.ultimaker.com" if self.options.staging else "https://account.ultimaker.com"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _marketplace_root(self):
|
||||||
|
return "https://marketplace-staging.ultimaker.com" if self.options.staging else "https://marketplace.ultimaker.com"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _digital_factory_url(self):
|
||||||
|
return "https://digitalfactory-staging.ultimaker.com" if self.options.staging else "https://digitalfactory.ultimaker.com"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def requirements_txts(self):
|
def requirements_txts(self):
|
||||||
if self.options.devtools:
|
if self.options.devtools:
|
||||||
|
@ -67,7 +94,21 @@ class CuraConan(ConanFile):
|
||||||
self.requires("pynest2d/latest@ultimaker/cura-9365") # FIXME: change to ultimaker/stable once the pynest2d PR for CURA-9365 has been merged
|
self.requires("pynest2d/latest@ultimaker/cura-9365") # FIXME: change to ultimaker/stable once the pynest2d PR for CURA-9365 has been merged
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
pass
|
with open(Path(self.source_folder, "cura", "CuraVersion.py.jinja"), "r") as f:
|
||||||
|
cura_version_py = Template(f.read())
|
||||||
|
|
||||||
|
with open(Path(self.source_folder, "cura", "CuraVersion.py"), "w") as f:
|
||||||
|
f.write(cura_version_py.render(
|
||||||
|
cura_app_name = self.name,
|
||||||
|
cura_app_display_name = self.options.display_name,
|
||||||
|
cura_version = self.version if self.version else "master",
|
||||||
|
cura_build_type = "Enterprise" if self.options.enterprise else "",
|
||||||
|
cura_debug_mode = self.settings.build_type != "Release",
|
||||||
|
cura_cloud_api_root = self._cloud_api_root,
|
||||||
|
cura_cloud_api_version = self.options.cloud_api_version,
|
||||||
|
cura_cloud_account_api_root = self._cloud_account_api_root,
|
||||||
|
cura_marketplace_root = self._marketplace_root,
|
||||||
|
cura_digital_factory_url = self._digital_factory_url))
|
||||||
|
|
||||||
def layout(self):
|
def layout(self):
|
||||||
self.folders.source = "."
|
self.folders.source = "."
|
||||||
|
|
13
cura/CuraVersion.py.jinja
Normal file
13
cura/CuraVersion.py.jinja
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Copyright (c) 2022 Ultimaker B.V.
|
||||||
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
CuraAppName = "{{ cura_app_name }}"
|
||||||
|
CuraAppDisplayName = "{{ cura_app_display_name }}"
|
||||||
|
CuraVersion = "{{ cura_version }}"
|
||||||
|
CuraBuildType = "{{ cura_build_type }}"
|
||||||
|
CuraDebugMode = {{ cura_debug_mode }}
|
||||||
|
CuraCloudAPIRoot = "{{ cura_cloud_api_root }}"
|
||||||
|
CuraCloudAPIVersion = "{{ cura_cloud_api_version }}"
|
||||||
|
CuraCloudAccountAPIRoot = "{{ cura_cloud_account_api_root }}"
|
||||||
|
CuraMarketplaceRoot = "{{ cura_marketplace_root }}"
|
||||||
|
CuraDigitalFactoryURL = "{{ cura_digital_factory_url }}"
|
Loading…
Add table
Add a link
Reference in a new issue