mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Using node-semver to validate version in conandata
Still not sure if this is the best approach. Contributes to CURA-9365
This commit is contained in:
parent
17d1d95217
commit
eb8e119e5c
2 changed files with 171 additions and 21 deletions
168
conandata.yml
168
conandata.yml
|
@ -1,26 +1,166 @@
|
||||||
requirements:
|
requirements:
|
||||||
|
"None":
|
||||||
|
- "arcus/(latest)@ultimaker/stable"
|
||||||
|
- "curaengine/(latest)@ultimaker/stable"
|
||||||
|
- "savitar/(latest)@ultimaker/stable"
|
||||||
|
- "pynest2d/(latest)@ultimaker/stable"
|
||||||
|
- "uranium/(latest)@ultimaker/stable"
|
||||||
|
- "fdm_materials/(latest)@ultimaker/stable"
|
||||||
|
- "cura_binary_data/(latest)@ultimaker/stable"
|
||||||
|
"5.1.0":
|
||||||
|
- "arcus/5.1.0"
|
||||||
|
- "curaengine/5.1.0"
|
||||||
|
- "savitar/5.1.0"
|
||||||
|
- "pynest2d/5.1.0"
|
||||||
|
- "uranium/5.1.0"
|
||||||
|
- "fdm_materials/5.1.0"
|
||||||
|
- "cura_binary_data/5.1.0"
|
||||||
"5.1.0-beta":
|
"5.1.0-beta":
|
||||||
- "arcus/[~5.1.0-beta]@ultimaker/stable"
|
- "arcus/[5.1.0-beta, include_prerelease=True]@ultimaker/stable"
|
||||||
- "curaengine/[~5.1.0-beta]@ultimaker/stable"
|
- "curaengine/[5.1.0-beta, include_prerelease=True]@ultimaker/stable"
|
||||||
- "savitar/[~5.1.0-beta]@ultimaker/stable"
|
- "savitar/[5.1.0-beta, include_prerelease=True]@ultimaker/stable"
|
||||||
- "pynest2d/[~5.1.0-beta]@ultimaker/stable"
|
- "pynest2d/[5.1.0-beta, include_prerelease=True]@ultimaker/stable"
|
||||||
- "uranium/[~5.1.0-beta]@ultimaker/stable"
|
- "uranium/[5.1.0-beta, include_prerelease=True]@ultimaker/stable"
|
||||||
- "fdm_materials/[~5.1.0-beta]@ultimaker/stable"
|
- "fdm_materials/[5.1.0-beta, include_prerelease=True]@ultimaker/stable"
|
||||||
- "cura_binary_data/[~5.1.0-beta]@ultimaker/stable"
|
- "cura_binary_data/[5.1.0-beta, include_prerelease=True]@ultimaker/stable"
|
||||||
"5.1.0-cura_9365":
|
"5.1.0-cura_9365":
|
||||||
- "arcus/~[5.1.0-cura_9365]@ultimaker/testing"
|
- "arcus/[5.1.0-cura_9365]@ultimaker/testing"
|
||||||
- "curaengine/[~5.1.0-cura_9365]@ultimaker/testing"
|
- "curaengine/[5.1.0-cura_9365]@ultimaker/testing"
|
||||||
- "savitar/[~5.1.0-cura_9365]@ultimaker/testing"
|
- "savitar/[5.1.0-cura_9365]@ultimaker/testing"
|
||||||
- "pynest2d/[~5.1.0-cura_9365]@ultimaker/testing"
|
- "pynest2d/[5.1.0-cura_9365]@ultimaker/testing"
|
||||||
- "uranium/[~5.1.0-cura_9365]@ultimaker/testing"
|
- "uranium/[5.1.0-cura_9365]@ultimaker/testing"
|
||||||
- "fdm_materials/[~5.1.0-cura_9365]@ultimaker/testing"
|
- "fdm_materials/[5.1.0-cura_9365]@ultimaker/testing"
|
||||||
- "cura_binary_data/[~5.1.0-cura_9365]@ultimaker/testing"
|
- "cura_binary_data/[5.1.0-cura_9365]@ultimaker/testing"
|
||||||
runinfo:
|
runinfo:
|
||||||
|
"None":
|
||||||
|
entrypoint: "cura_app.py"
|
||||||
"5.1.0-beta":
|
"5.1.0-beta":
|
||||||
entrypoint: "cura_app.py"
|
entrypoint: "cura_app.py"
|
||||||
|
"5.1.0":
|
||||||
|
entrypoint: "cura_app.py"
|
||||||
"5.1.0-cura_9365":
|
"5.1.0-cura_9365":
|
||||||
entrypoint: "cura_app.py"
|
entrypoint: "cura_app.py"
|
||||||
pyinstaller:
|
pyinstaller:
|
||||||
|
"None":
|
||||||
|
datas:
|
||||||
|
cura_plugins:
|
||||||
|
root: "."
|
||||||
|
src: "plugins"
|
||||||
|
dst: "share/cura/plugins"
|
||||||
|
cura_resources:
|
||||||
|
root: "."
|
||||||
|
src: "resources"
|
||||||
|
dst: "share/cura/resources"
|
||||||
|
uranium_plugins:
|
||||||
|
package: "uranium"
|
||||||
|
src: "site-packages/plugins"
|
||||||
|
dst: "share/uranium/plugins"
|
||||||
|
uranium_resources:
|
||||||
|
package: "uranium"
|
||||||
|
src: "res/resources"
|
||||||
|
dst: "share/uranium/resources"
|
||||||
|
uranium_um_qt_qml_um:
|
||||||
|
package: "uranium"
|
||||||
|
src: "site-packages/UM/Qt/qml/UM"
|
||||||
|
dst: "PyQt6/qt6/qml/UM"
|
||||||
|
cura_binary_data:
|
||||||
|
package: "cura_binary_data"
|
||||||
|
src: "res/cura/resources"
|
||||||
|
dst: "share/cura/resources"
|
||||||
|
uranium_binary_data:
|
||||||
|
package: "cura_binary_data"
|
||||||
|
src: "res/uranium/resources"
|
||||||
|
dst: "share/uranium/resources"
|
||||||
|
fdm_materials:
|
||||||
|
package: "fdm_materials"
|
||||||
|
src: "res/materials"
|
||||||
|
dst: "share/cura/resources/materials"
|
||||||
|
binaries:
|
||||||
|
curaengine:
|
||||||
|
package: "curaengine"
|
||||||
|
src: "bin"
|
||||||
|
dst: "."
|
||||||
|
binary: "CuraEngine"
|
||||||
|
hiddenimports:
|
||||||
|
- "pySavitar"
|
||||||
|
- "pyArcus"
|
||||||
|
- "pynest2d"
|
||||||
|
- "PyQt6.QtNetwork"
|
||||||
|
- "logging.handlers"
|
||||||
|
- "zeroconf"
|
||||||
|
- "fcntl"
|
||||||
|
collect_all:
|
||||||
|
- "cura"
|
||||||
|
- "UM"
|
||||||
|
- "serial"
|
||||||
|
- "Charon"
|
||||||
|
- "sqlite3"
|
||||||
|
- "trimesh"
|
||||||
|
- "win32ctypes"
|
||||||
|
icon:
|
||||||
|
Windows: "./icons/Cura.ico"
|
||||||
|
Macos: "./icons/cura.icns"
|
||||||
|
Linux: ".icons/cura-128.png"
|
||||||
|
"5.1.0":
|
||||||
|
datas:
|
||||||
|
cura_plugins:
|
||||||
|
root: "."
|
||||||
|
src: "plugins"
|
||||||
|
dst: "share/cura/plugins"
|
||||||
|
cura_resources:
|
||||||
|
root: "."
|
||||||
|
src: "resources"
|
||||||
|
dst: "share/cura/resources"
|
||||||
|
uranium_plugins:
|
||||||
|
package: "uranium"
|
||||||
|
src: "site-packages/plugins"
|
||||||
|
dst: "share/uranium/plugins"
|
||||||
|
uranium_resources:
|
||||||
|
package: "uranium"
|
||||||
|
src: "res/resources"
|
||||||
|
dst: "share/uranium/resources"
|
||||||
|
uranium_um_qt_qml_um:
|
||||||
|
package: "uranium"
|
||||||
|
src: "site-packages/UM/Qt/qml/UM"
|
||||||
|
dst: "PyQt6/qt6/qml/UM"
|
||||||
|
cura_binary_data:
|
||||||
|
package: "cura_binary_data"
|
||||||
|
src: "res/cura/resources"
|
||||||
|
dst: "share/cura/resources"
|
||||||
|
uranium_binary_data:
|
||||||
|
package: "cura_binary_data"
|
||||||
|
src: "res/uranium/resources"
|
||||||
|
dst: "share/uranium/resources"
|
||||||
|
fdm_materials:
|
||||||
|
package: "fdm_materials"
|
||||||
|
src: "res/materials"
|
||||||
|
dst: "share/cura/resources/materials"
|
||||||
|
binaries:
|
||||||
|
curaengine:
|
||||||
|
package: "curaengine"
|
||||||
|
src: "bin"
|
||||||
|
dst: "."
|
||||||
|
binary: "CuraEngine"
|
||||||
|
hiddenimports:
|
||||||
|
- "pySavitar"
|
||||||
|
- "pyArcus"
|
||||||
|
- "pynest2d"
|
||||||
|
- "PyQt6.QtNetwork"
|
||||||
|
- "logging.handlers"
|
||||||
|
- "zeroconf"
|
||||||
|
- "fcntl"
|
||||||
|
collect_all:
|
||||||
|
- "cura"
|
||||||
|
- "UM"
|
||||||
|
- "serial"
|
||||||
|
- "Charon"
|
||||||
|
- "sqlite3"
|
||||||
|
- "trimesh"
|
||||||
|
- "win32ctypes"
|
||||||
|
icon:
|
||||||
|
Windows: "./icons/Cura.ico"
|
||||||
|
Macos: "./icons/cura.icns"
|
||||||
|
Linux: ".icons/cura-128.png"
|
||||||
"5.1.0-beta":
|
"5.1.0-beta":
|
||||||
datas:
|
datas:
|
||||||
cura_plugins:
|
cura_plugins:
|
||||||
|
|
24
conanfile.py
24
conanfile.py
|
@ -4,6 +4,7 @@ from pathlib import Path
|
||||||
from platform import python_version
|
from platform import python_version
|
||||||
|
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
from semver import *
|
||||||
|
|
||||||
from conan import ConanFile
|
from conan import ConanFile
|
||||||
from conan.tools import files
|
from conan.tools import files
|
||||||
|
@ -50,9 +51,18 @@ class CuraConan(ConanFile):
|
||||||
}
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _conan_data_version(self):
|
def _conan_data(self):
|
||||||
version = tools.Version(self.version)
|
data = {}
|
||||||
return f"{version.major}.{version.minor}.{version.patch}-{version.prerelease}"
|
if self.version:
|
||||||
|
for k, vers in self.conan_data.items():
|
||||||
|
for v in vers:
|
||||||
|
if v != "None":
|
||||||
|
if satisfies(self.version, v, loose = True, include_prerelease = False):
|
||||||
|
data[k] = vers[v]
|
||||||
|
else:
|
||||||
|
for k, ver in self.conan_data.items():
|
||||||
|
data[k] = ver["None"]
|
||||||
|
return data
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _staging(self):
|
def _staging(self):
|
||||||
|
@ -93,11 +103,11 @@ class CuraConan(ConanFile):
|
||||||
self.options["*"].python_version = self.options.python_version
|
self.options["*"].python_version = self.options.python_version
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if tools.Version(self.version) <= tools.Version("4"):
|
if self.version and tools.Version(self.version) <= tools.Version("4"):
|
||||||
raise ConanInvalidConfiguration("Only versions 5+ are support")
|
raise ConanInvalidConfiguration("Only versions 5+ are support")
|
||||||
|
|
||||||
def requirements(self):
|
def requirements(self):
|
||||||
for req in self.conan_data["requirements"][self._conan_data_version]:
|
for req in self._conan_data["requirements"]:
|
||||||
self.requires(req)
|
self.requires(req)
|
||||||
|
|
||||||
def layout(self):
|
def layout(self):
|
||||||
|
@ -133,7 +143,7 @@ class CuraConan(ConanFile):
|
||||||
with open(Path(self.source_folder, "Ultimaker-Cura.spec.jinja"), "r") as f:
|
with open(Path(self.source_folder, "Ultimaker-Cura.spec.jinja"), "r") as f:
|
||||||
pyinstaller = Template(f.read())
|
pyinstaller = Template(f.read())
|
||||||
|
|
||||||
pyinstaller_metadata = self.conan_data["pyinstaller"][self._conan_data_version]
|
pyinstaller_metadata = self._conan_data["pyinstaller"]
|
||||||
datas = []
|
datas = []
|
||||||
for data in pyinstaller_metadata["datas"].values():
|
for data in pyinstaller_metadata["datas"].values():
|
||||||
if "package" in data: # get the paths from conan package
|
if "package" in data: # get the paths from conan package
|
||||||
|
@ -166,7 +176,7 @@ class CuraConan(ConanFile):
|
||||||
with open(Path(self.generators_folder, "Ultimaker-Cura.spec"), "w") as f:
|
with open(Path(self.generators_folder, "Ultimaker-Cura.spec"), "w") as f:
|
||||||
f.write(pyinstaller.render(
|
f.write(pyinstaller.render(
|
||||||
name = str(self.options.display_name).replace(" ", "-"),
|
name = str(self.options.display_name).replace(" ", "-"),
|
||||||
entrypoint = self.conan_data["runinfo"][self._conan_data_version]["entrypoint"],
|
entrypoint = self._conan_data["runinfo"]["entrypoint"],
|
||||||
datas = datas,
|
datas = datas,
|
||||||
binaries = binaries,
|
binaries = binaries,
|
||||||
hiddenimports = pyinstaller_metadata["hiddenimports"],
|
hiddenimports = pyinstaller_metadata["hiddenimports"],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue