Skip to content

Commit

Permalink
Use mainstream Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Sep 16, 2024
1 parent c5eb37a commit 966e591
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_policy(SET CMP0091 NEW)
project(pysavitar)
cmake_minimum_required(VERSION 3.20)

find_package(cpython REQUIRED)
find_package(Python REQUIRED)
find_package(savitar REQUIRED)

find_package(standardprojectsettings REQUIRED)
Expand Down
23 changes: 8 additions & 15 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.env import VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import copy, mkdir, update_conandata
from conan.tools.build import check_min_cppstd
from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime
from conan.tools.scm import Version, Git

required_conan_version = ">=1.58.0"
required_conan_version = ">=2.7.0"


class PySavitarConan(ConanFile):
Expand All @@ -23,7 +23,7 @@ class PySavitarConan(ConanFile):
topics = ("conan", "cura", "3mf", "c++")
settings = "os", "compiler", "build_type", "arch"
exports = "LICENSE*"
generators = "CMakeDeps", "VirtualRunEnv"
generators = "CMakeDeps"

python_requires = "pyprojecttoolchain/[>=0.2.0]@ultimaker/cura_11622", "sipbuildtool/[>=0.3.0]@ultimaker/cura_11622" # FIXME: use stable after merge

Expand Down Expand Up @@ -84,7 +84,7 @@ def validate(self):
def build_requirements(self):
self.test_requires("standardprojectsettings/[>=0.2.0]@ultimaker/cura_11622") # FIXME: use stable after merge
self.test_requires("sipbuildtool/[>=0.3.0]@ultimaker/cura_11622") # FIXME: use stable after merge
self.test_requires("cpython/3.12.2@ultimaker/cura_11622") # FIXME: use stable after merge
self.test_requires("cpython/3.12.2")

def config_options(self):
if self.settings.os == "Windows":
Expand All @@ -107,20 +107,13 @@ def generate(self):
if is_msvc(self):
tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self)
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0148"] = "OLD"
cpython_conf = self.dependencies["cpython"].conf_info
tc.variables["Python_EXECUTABLE"] = cpython_conf.get("user.cpython:python").replace("\\", "/")
tc.variables["Python_ROOT_DIR"] = cpython_conf.get("user.cpython:python_root").replace("\\", "/")
cpython_options = self.dependencies["cpython"].options
tc.variables["Python_USE_STATIC_LIBS"] = not cpython_options.shared
tc.variables["Python_FIND_FRAMEWORK"] = "NEVER"
tc.variables["Python_FIND_REGISTRY"] = "NEVER"
tc.variables["Python_FIND_IMPLEMENTATIONS"] = "CPython"
tc.variables["Python_FIND_STRATEGY"] = "LOCATION"
tc.variables["Python_SITEARCH"] = "site-packages"
tc.generate()

vb = VirtualBuildEnv(self)
vb.generate(scope="build")
vb.generate()

vr = VirtualRunEnv(self)
vr.generate(scope="build")

# Generate the Source code from SIP
sip = self.python_requires["sipbuildtool"].module.SipBuildTool(self)
Expand Down

0 comments on commit 966e591

Please sign in to comment.