From 673df9caefe19136249cd1411bb145744b5fbaed Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Tue, 28 Nov 2023 07:08:08 +0100 Subject: [PATCH 01/10] Update README.md --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bcde285..f1de8f5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Ultimaker Conan configuration files -> Conan is preparing a major update to 2.0, to ensure future proofing our recipes make sure you set the `CONAN_V2_MODE=1` -> environment variable. -> https://docs.conan.io/en/latest/reference/conan_v2_mode.html +**Conan configuration for Community developers** + +use as: +``` +conan config install https://github.com/Ultimaker/conan-config.git +``` From 78d838739a43d54170171206fc32520533615514 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Tue, 28 Nov 2023 16:09:59 +0100 Subject: [PATCH 02/10] Update cura remote Contributes to CURA-11300 --- remotes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remotes.txt b/remotes.txt index e027f9c..b5a5b52 100644 --- a/remotes.txt +++ b/remotes.txt @@ -1,3 +1,3 @@ -cura https://ultimaker.jfrog.io/artifactory/api/conan/cura-internal True +cura https://cura.jfrog.io/artifactory/api/conan/cura-conan-dev True cura-conan-dev https://cura.jfrog.io/artifactory/api/conan/cura-conan-dev True conan-center https://center.conan.io True From 5455d3c7fc29db3a3fd6e082dff7464998cbb03d Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Tue, 28 Nov 2023 16:28:31 +0100 Subject: [PATCH 03/10] remove cura-conan-dev Contributes to CURA-11300 --- remotes.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/remotes.txt b/remotes.txt index b5a5b52..0a63ed6 100644 --- a/remotes.txt +++ b/remotes.txt @@ -1,3 +1 @@ cura https://cura.jfrog.io/artifactory/api/conan/cura-conan-dev True -cura-conan-dev https://cura.jfrog.io/artifactory/api/conan/cura-conan-dev True -conan-center https://center.conan.io True From 9df6f7a53de18e1b807e541b0f44012464d8afca Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 23 Dec 2023 18:30:03 +0100 Subject: [PATCH 04/10] use cpp std 20 for cura_settings --- profiles/cura.jinja | 1 + 1 file changed, 1 insertion(+) diff --git a/profiles/cura.jinja b/profiles/cura.jinja index a68b097..4bfe850 100644 --- a/profiles/cura.jinja +++ b/profiles/cura.jinja @@ -12,6 +12,7 @@ curaengine_grpc_definitions:compiler.cppstd=20 scripta:compiler.cppstd=20 umspatial*:compiler.cppstd=20 dulcificum:compiler.cppstd=20 +cura_settings:compiler.cppstd=20 {% if compiler == 'gcc' %}compiler.libcxx=libstdc++11 {% elif compiler == 'apple-clang' %}compiler.libcxx=libc++ From 4a9a3bd40756af7e4d59f52c0e2fa6bf8e6215aa Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 26 Jan 2024 12:24:37 +0100 Subject: [PATCH 05/10] Fix Environment variable for VirtualPythonEnv --- generators/VirtualPythonEnv.py | 96 +++++++++++++++++----------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/generators/VirtualPythonEnv.py b/generators/VirtualPythonEnv.py index acd7e50..afb32c0 100644 --- a/generators/VirtualPythonEnv.py +++ b/generators/VirtualPythonEnv.py @@ -7,14 +7,12 @@ from pathlib import Path from jinja2 import Template -from conan import ConanFile from conan.tools.env import VirtualRunEnv from conans.model import Generator from conans.errors import ConanException -class VirtualPythonEnv(Generator): - +class VirtualPythonEnv_bk(Generator): @property def _script_ext(self): if self.conanfile.settings.get_safe("os") == "Windows": @@ -33,27 +31,29 @@ class VirtualPythonEnv(Generator): @property def content(self): - conanfile: ConanFile = self.conanfile python_interpreter = Path(self.conanfile.deps_user_info["cpython"].python) # When on Windows execute as Windows Path - if conanfile.settings.os == "Windows": + if self.conanfile.settings.os == "Windows": python_interpreter = Path(*[f'"{p}"' if " " in p else p for p in python_interpreter.parts]) # Create the virtual environment - print(f"Creating virtual environment in {conanfile.install_folder}") - print(f"Creating virtual environment in {conanfile.build_folder}") - if conanfile.in_local_cache: - venv_folder = conanfile.install_folder + if self.conanfile.in_local_cache: + venv_folder = self.conanfile.install_folder else: - venv_folder = conanfile.build_folder if conanfile.build_folder else Path(os.getcwd(), "venv") + venv_folder = self.conanfile.build_folder if self.conanfile.build_folder else Path(os.getcwd(), "venv") + + self.conanfile.output.info(f"Creating virtual environment in {venv_folder}") + run_env = VirtualRunEnv(self.conanfile) + env = run_env.environment() + sys_vars = env.vars(self.conanfile, scope = "run") - conanfile.output.info(f"Creating virtual environment in {venv_folder}") - conanfile.run(f"""{python_interpreter} -m venv {venv_folder}""", run_environment = True, env = "conanrun") + with sys_vars.apply(): + self.conanfile.run(f"""{python_interpreter} -m venv {venv_folder}""", scope = "run") # Make sure there executable is named the same on all three OSes this allows it to be called with `python` # simplifying GH Actions steps - if conanfile.settings.os != "Windows": + if self.conanfile.settings.os != "Windows": python_venv_interpreter = Path(venv_folder, self._venv_path, "python") if not python_venv_interpreter.exists(): python_venv_interpreter.hardlink_to( @@ -63,20 +63,18 @@ class VirtualPythonEnv(Generator): if not python_venv_interpreter.exists(): raise ConanException(f"Virtual environment Python interpreter not found at: {python_venv_interpreter}") - if conanfile.settings.os == "Windows": + if self.conanfile.settings.os == "Windows": python_venv_interpreter = Path(*[f'"{p}"' if " " in p else p for p in python_venv_interpreter.parts]) buffer = StringIO() - outer = '"' if conanfile.settings.os == "Windows" else "'" - inner = "'" if conanfile.settings.os == "Windows" else '"' - conanfile.run(f"{python_venv_interpreter} -c {outer}import sysconfig; print(sysconfig.get_path({inner}purelib{inner})){outer}", - env = "conanrun", - output = buffer) + outer = '"' if self.conanfile.settings.os == "Windows" else "'" + inner = "'" if self.conanfile.settings.os == "Windows" else '"' + with sys_vars.apply(): + self.conanfile.run(f"""{python_venv_interpreter} -c {outer}import sysconfig; print(sysconfig.get_path({inner}purelib{inner})){outer}""", + env = "conanrun", + output = buffer) pythonpath = buffer.getvalue().splitlines()[-1] - run_env = VirtualRunEnv(conanfile) - env = run_env.environment() - if hasattr(self.conanfile, f"_{self.conanfile.name}_run_env"): project_run_env = getattr(self.conanfile, f"_{self.conanfile.name}_run_env") if project_run_env: @@ -88,61 +86,63 @@ class VirtualPythonEnv(Generator): env.prepend_path("DYLD_LIBRARY_PATH", os.path.join(venv_folder, self._venv_path)) env.prepend_path("PYTHONPATH", pythonpath) env.unset("PYTHONHOME") + venv_vars = env.vars(self.conanfile, scope = "run") # Install some base_packages - conanfile.run(f"""{python_venv_interpreter} -m pip install wheel setuptools""", run_environment = True, env = "conanrun") + with venv_vars.apply(): + self.conanfile.run(f"""{python_venv_interpreter} -m pip install wheel setuptools""", env = "conanrun") # Install pip_requirements from dependencies - for dep_name in reversed(conanfile.deps_user_info): - dep_user_info = conanfile.deps_user_info[dep_name] + for dep_name in reversed(self.conanfile.deps_user_info): + dep_user_info = self.conanfile.deps_user_info[dep_name] if len(dep_user_info.vars) == 0: continue - pip_req_paths = [conanfile.deps_cpp_info[dep_name].res_paths[i] for i, req_path in - enumerate(conanfile.deps_cpp_info[dep_name].resdirs) if req_path.endswith("pip_requirements")] + pip_req_paths = [self.conanfile.deps_cpp_info[dep_name].res_paths[i] for i, req_path in + enumerate(self.conanfile.deps_cpp_info[dep_name].resdirs) if req_path.endswith("pip_requirements")] if len(pip_req_paths) != 1: continue pip_req_base_path = Path(pip_req_paths[0]) if hasattr(dep_user_info, "pip_requirements"): req_txt = pip_req_base_path.joinpath(dep_user_info.pip_requirements) if req_txt.exists(): - conanfile.run(f"{python_venv_interpreter} -m pip install -r {req_txt} --upgrade", run_environment = True, - env = "conanrun") - conanfile.output.success(f"Dependency {dep_name} specifies pip_requirements in user_info installed!") + with venv_vars.apply(): + self.conanfile.run(f"{python_venv_interpreter} -m pip install -r {req_txt} --upgrade", env = "conanrun") + self.conanfile.output.success(f"Dependency {dep_name} specifies pip_requirements in user_info installed!") else: - conanfile.output.warn(f"Dependency {dep_name} specifies pip_requirements in user_info but {req_txt} can't be found!") + self.conanfile.output.warn(f"Dependency {dep_name} specifies pip_requirements in user_info but {req_txt} can't be found!") if hasattr(dep_user_info, "pip_requirements_git"): req_txt = pip_req_base_path.joinpath(dep_user_info.pip_requirements_git) if req_txt.exists(): - conanfile.run(f"{python_venv_interpreter} -m pip install -r {req_txt} --upgrade", run_environment = True, - env = "conanrun") - conanfile.output.success(f"Dependency {dep_name} specifies pip_requirements_git in user_info installed!") + with venv_vars.apply(): + self.conanfile.run(f"{python_venv_interpreter} -m pip install -r {req_txt} --upgrade", env = "conanrun") + self.conanfile.output.success(f"Dependency {dep_name} specifies pip_requirements_git in user_info installed!") else: - conanfile.output.warn( + self.conanfile.output.warn( f"Dependency {dep_name} specifies pip_requirements_git in user_info but {req_txt} can't be found!") if hasattr(dep_user_info, "pip_requirements_build"): req_txt = pip_req_base_path.joinpath(dep_user_info.pip_requirements_build) if req_txt.exists(): - conanfile.run(f"{python_venv_interpreter} -m pip install -r {req_txt} --upgrade", run_environment = True, - env = "conanrun") - conanfile.output.success(f"Dependency {dep_name} specifies pip_requirements_build in user_info installed!") + with venv_vars.apply(): + self.conanfile.run(f"{python_venv_interpreter} -m pip install -r {req_txt} --upgrade", env = "conanrun") + self.conanfile.output.success(f"Dependency {dep_name} specifies pip_requirements_build in user_info installed!") else: - conanfile.output.warn( + self.conanfile.output.warn( f"Dependency {dep_name} specifies pip_requirements_build in user_info but {req_txt} can't be found!") - if not conanfile.in_local_cache and hasattr(conanfile, "requirements_txts"): + if not self.conanfile.in_local_cache and hasattr(self.conanfile, "requirements_txts"): # Install the Python requirements of the current conanfile requirements*.txt - pip_req_base_path = Path(conanfile.source_folder) + pip_req_base_path = Path(self.conanfile.source_folder) - for req_path in sorted(conanfile.requirements_txts, reverse = True): + for req_path in sorted(self.conanfile.requirements_txts, reverse = True): req_txt = pip_req_base_path.joinpath(req_path) if req_txt.exists(): - conanfile.run(f"{python_venv_interpreter} -m pip install -r {req_txt} --upgrade", run_environment = True, - env = "conanrun") - conanfile.output.success(f"Requirements file {req_txt} installed!") + with venv_vars.apply(): + self.conanfile.run(f"{python_venv_interpreter} -m pip install -r {req_txt} --upgrade", env = "conanrun") + self.conanfile.output.success(f"Requirements file {req_txt} installed!") else: - conanfile.output.warn(f"Requirements file {req_txt} can't be found!") + self.conanfile.output.warn(f"Requirements file {req_txt} can't be found!") # Add all dlls/dylibs/so found in site-packages to the PATH, DYLD_LIBRARY_PATH and LD_LIBRARY_PATH dll_paths = list({ dll.parent for dll in Path(pythonpath).glob("**/*.dll") }) @@ -157,7 +157,7 @@ class VirtualPythonEnv(Generator): for so_path in so_paths: env.append_path("LD_LIBRARY_PATH", str(so_path)) - full_envvars = env.vars(conanfile, scope = "conanrun") + full_envvars = env.vars(self.conanfile, scope = "conanrun") # Generate the Python Virtual Environment Script full_envvars.save_sh(Path(venv_folder, self._venv_path, "activate")) @@ -165,7 +165,7 @@ class VirtualPythonEnv(Generator): full_envvars.save_ps1(Path(venv_folder, self._venv_path, "Activate.ps1")) # Generate the GitHub Action activation script - env_prefix = "Env:" if conanfile.settings.os == "Windows" else "" + env_prefix = "Env:" if self.conanfile.settings.os == "Windows" else "" activate_github_actions_buildenv = Template(r"""{% for var, value in envvars.items() %}echo "{{ var }}={{ value }}" >> ${{ env_prefix }}GITHUB_ENV {% endfor %}""").render(envvars = full_envvars, env_prefix = env_prefix) From 3cc473e1e67e0cfc21e2a9fcd159ad1026ae2796 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Wed, 31 Jan 2024 14:04:33 +0100 Subject: [PATCH 06/10] Rename VirtualPythonEnv to correct name --- generators/VirtualPythonEnv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/VirtualPythonEnv.py b/generators/VirtualPythonEnv.py index afb32c0..d257a18 100644 --- a/generators/VirtualPythonEnv.py +++ b/generators/VirtualPythonEnv.py @@ -12,7 +12,7 @@ from conans.model import Generator from conans.errors import ConanException -class VirtualPythonEnv_bk(Generator): +class VirtualPythonEnv(Generator): @property def _script_ext(self): if self.conanfile.settings.get_safe("os") == "Windows": From 6f3c2cc70e49d27aefa3c2570baca95f47e67cc9 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 18 May 2024 14:43:39 +0200 Subject: [PATCH 07/10] Use C++20 per default Contribute to NP-202 --- profiles/cura.jinja | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/profiles/cura.jinja b/profiles/cura.jinja index 4bfe850..187cde7 100644 --- a/profiles/cura.jinja +++ b/profiles/cura.jinja @@ -3,16 +3,8 @@ include(default) [build_requires] [settings] -compiler.cppstd=17 -curaengine:compiler.cppstd=20 -curaengine*:compiler.cppstd=20 -curaengine_plugin_infill_generate:compiler.cppstd=20 -curaengine_plugin_gradual_flow:compiler.cppstd=20 -curaengine_grpc_definitions:compiler.cppstd=20 -scripta:compiler.cppstd=20 -umspatial*:compiler.cppstd=20 -dulcificum:compiler.cppstd=20 -cura_settings:compiler.cppstd=20 +compiler.cppstd=20 +nest2d:compiler.cppstd=17 {% if compiler == 'gcc' %}compiler.libcxx=libstdc++11 {% elif compiler == 'apple-clang' %}compiler.libcxx=libc++ From 769f3c9106f5fa75c9e22468922cfc678051e9aa Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sun, 19 May 2024 15:22:05 +0200 Subject: [PATCH 08/10] compile pynest2d with c++17 Contribute to NP-202 --- profiles/cura.jinja | 1 + 1 file changed, 1 insertion(+) diff --git a/profiles/cura.jinja b/profiles/cura.jinja index 187cde7..15626f9 100644 --- a/profiles/cura.jinja +++ b/profiles/cura.jinja @@ -5,6 +5,7 @@ include(default) [settings] compiler.cppstd=20 nest2d:compiler.cppstd=17 +pynest2d:compiler.cppstd=17 {% if compiler == 'gcc' %}compiler.libcxx=libstdc++11 {% elif compiler == 'apple-clang' %}compiler.libcxx=libc++ From ef47e8ec57e0914a5c18105030ee144652effebb Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Tue, 21 May 2024 09:00:08 +0200 Subject: [PATCH 09/10] use c++17 as standard again Contribute to NP-202 --- profiles/cura.jinja | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/profiles/cura.jinja b/profiles/cura.jinja index 15626f9..4bfe850 100644 --- a/profiles/cura.jinja +++ b/profiles/cura.jinja @@ -3,9 +3,16 @@ include(default) [build_requires] [settings] -compiler.cppstd=20 -nest2d:compiler.cppstd=17 -pynest2d:compiler.cppstd=17 +compiler.cppstd=17 +curaengine:compiler.cppstd=20 +curaengine*:compiler.cppstd=20 +curaengine_plugin_infill_generate:compiler.cppstd=20 +curaengine_plugin_gradual_flow:compiler.cppstd=20 +curaengine_grpc_definitions:compiler.cppstd=20 +scripta:compiler.cppstd=20 +umspatial*:compiler.cppstd=20 +dulcificum:compiler.cppstd=20 +cura_settings:compiler.cppstd=20 {% if compiler == 'gcc' %}compiler.libcxx=libstdc++11 {% elif compiler == 'apple-clang' %}compiler.libcxx=libc++ From f6f7779fa795a67f8d35af0a9abb05e937418db1 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 15 Jun 2024 13:25:02 +0200 Subject: [PATCH 10/10] skip_broken_symlinks_check needed for wasm compilation --- conan.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/conan.conf b/conan.conf index 0ab8d76..5d1090d 100644 --- a/conan.conf +++ b/conan.conf @@ -14,6 +14,7 @@ revisions_enabled = True scm_to_conandata = True use_always_short_paths = True config_install_interval = 12h +skip_broken_symlinks_check = True [storage] path = ./data