From 61691b0232316c2b37c889ff859d4c1e89eb7382 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 20 Jun 2022 00:05:09 +0200 Subject: [PATCH] (#11075) [pybind11] Do not support Mac for now * cache cmake Signed-off-by: Uilian Ries * Skip Mac support Signed-off-by: Uilian Ries * Remove old versions Signed-off-by: Uilian Ries * Update not supported OS Signed-off-by: Uilian Ries * Skip apple-clang 11 Signed-off-by: Uilian Ries * Skip apple-clang 11 Signed-off-by: Uilian Ries * Skip apple-clang 12 Signed-off-by: Uilian Ries * Skip apple-clang 13 Signed-off-by: Uilian Ries --- recipes/pybind11/all/conandata.yml | 18 ----------- recipes/pybind11/all/conanfile.py | 31 +++++++++++-------- .../pybind11/all/test_package/CMakeLists.txt | 7 +---- .../pybind11/all/test_package/conanfile.py | 4 +-- recipes/pybind11/config.yml | 12 ------- 5 files changed, 21 insertions(+), 51 deletions(-) diff --git a/recipes/pybind11/all/conandata.yml b/recipes/pybind11/all/conandata.yml index aeb7117e876c9..96f8c03a73c4e 100644 --- a/recipes/pybind11/all/conandata.yml +++ b/recipes/pybind11/all/conandata.yml @@ -1,22 +1,4 @@ sources: - 2.4.3: - url: "https://github.com/pybind/pybind11/archive/v2.4.3.tar.gz" - sha256: "1eed57bc6863190e35637290f97a20c81cfe4d9090ac0a24f3bbf08f265eb71d" - 2.5.0: - url: "https://github.com/pybind/pybind11/archive/v2.5.0.tar.gz" - sha256: "97504db65640570f32d3fdf701c25a340c8643037c3b69aec469c10c93dc8504" - 2.6.0: - url: "https://github.com/pybind/pybind11/archive/v2.6.0.tar.gz" - sha256: "90b705137b69ee3b5fc655eaca66d0dc9862ea1759226f7ccd3098425ae69571" - 2.6.1: - url: "https://github.com/pybind/pybind11/archive/v2.6.1.tar.gz" - sha256: "cdbe326d357f18b83d10322ba202d69f11b2f49e2d87ade0dc2be0c5c34f8e2a" - 2.6.2: - url: "https://github.com/pybind/pybind11/archive/v2.6.2.tar.gz" - sha256: "8ff2fff22df038f5cd02cea8af56622bc67f5b64534f1b83b9f133b8366acff2" - 2.7.0: - url: "https://github.com/pybind/pybind11/archive/v2.7.0.tar.gz" - sha256: "6cd73b3d0bf3daf415b5f9b87ca8817cc2e2b64c275d65f9500250f9fee1677e" 2.7.1: url: "https://github.com/pybind/pybind11/archive/v2.7.1.tar.gz" sha256: "616d1c42e4cf14fa27b2a4ff759d7d7b33006fdc5ad8fd603bb2c22622f27020" diff --git a/recipes/pybind11/all/conanfile.py b/recipes/pybind11/all/conanfile.py index d8c61d1ac5228..21d8e823b7e41 100644 --- a/recipes/pybind11/all/conanfile.py +++ b/recipes/pybind11/all/conanfile.py @@ -1,5 +1,8 @@ from conans import ConanFile, tools, CMake +from conans.errors import ConanInvalidConfiguration import os +import functools + required_conan_version = ">=1.33.0" @@ -16,24 +19,26 @@ class PyBind11Conan(ConanFile): generators = "cmake" no_copy_source = True - _source_subfolder = "source_subfolder" - _cmake = None + @property + def _source_subfolder(self): + return "source_subfolder" def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("{}-{}".format(self.name, self.version), - self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + + def validate(self): + if self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) >= "11.0": + raise ConanInvalidConfiguration("OSX support is bugged. Check https://github.com/pybind/pybind11/issues/3081") + @functools.lru_cache(1) def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["PYBIND11_INSTALL"] = True - self._cmake.definitions["PYBIND11_TEST"] = False - self._cmake.definitions["PYBIND11_CMAKECONFIG_INSTALL_DIR"] = "lib/cmake/pybind11" - self._cmake.configure() - return self._cmake + cmake = CMake(self) + cmake.definitions["PYBIND11_INSTALL"] = True + cmake.definitions["PYBIND11_TEST"] = False + cmake.definitions["PYBIND11_CMAKECONFIG_INSTALL_DIR"] = "lib/cmake/pybind11" + cmake.configure() + return cmake def build(self): cmake = self._configure_cmake() diff --git a/recipes/pybind11/all/test_package/CMakeLists.txt b/recipes/pybind11/all/test_package/CMakeLists.txt index 61e1eb6651125..7912a22ff7b4f 100644 --- a/recipes/pybind11/all/test_package/CMakeLists.txt +++ b/recipes/pybind11/all/test_package/CMakeLists.txt @@ -10,12 +10,7 @@ conan_check_compiler() conan_set_libcxx() conan_set_vs_runtime() -find_package(pybind11 REQUIRED) +find_package(pybind11 REQUIRED CONFIG) pybind11_add_module(test_package MODULE test_package.cpp) set_property(TARGET test_package PROPERTY CXX_STANDARD 11) - -enable_testing() - -add_test(run_example - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test.py ${CMAKE_CURRENT_BINARY_DIR}/lib) diff --git a/recipes/pybind11/all/test_package/conanfile.py b/recipes/pybind11/all/test_package/conanfile.py index 755b637565646..844a7165c3fbe 100644 --- a/recipes/pybind11/all/test_package/conanfile.py +++ b/recipes/pybind11/all/test_package/conanfile.py @@ -6,7 +6,7 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) @@ -21,7 +21,7 @@ def _python_interpreter(self): return sys.executable def test(self): - if not tools.cross_building(self.settings): + if not tools.cross_building(self): with tools.environment_append({"PYTHONPATH": "lib"}): self.run("{} {}".format(self._python_interpreter, os.path.join( self.source_folder, "test.py")), run_environment=True) diff --git a/recipes/pybind11/config.yml b/recipes/pybind11/config.yml index de3fb2ffa92ca..65e65f799a113 100644 --- a/recipes/pybind11/config.yml +++ b/recipes/pybind11/config.yml @@ -1,16 +1,4 @@ versions: - "2.4.3": - folder: all - "2.5.0": - folder: all - "2.6.0": - folder: all - "2.6.1": - folder: all - "2.6.2": - folder: all - "2.7.0": - folder: all "2.7.1": folder: all "2.8.1":