From 0d5646fe6080934177c80ffc53476a332c1901eb Mon Sep 17 00:00:00 2001 From: andrei malashkin Date: Wed, 24 Aug 2022 12:37:03 +0200 Subject: [PATCH] migrate backward-cpp to conan v2 --- recipes/backward-cpp/all/conanfile.py | 17 +++++++++-------- .../backward-cpp/all/test_package/conanfile.py | 5 +++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/recipes/backward-cpp/all/conanfile.py b/recipes/backward-cpp/all/conanfile.py index a3191f7258846..b2e0b3a5363e2 100644 --- a/recipes/backward-cpp/all/conanfile.py +++ b/recipes/backward-cpp/all/conanfile.py @@ -1,5 +1,6 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile, tools +from conans import CMake +from conan.errors import ConanInvalidConfiguration import os required_conan_version = ">=1.43.0" @@ -41,7 +42,7 @@ def _build_subfolder(self): @property def _supported_os(self): supported_os = ["Linux", "Macos", "Android"] - if tools.Version(self.version) >= "1.5": + if tools.scm.Version(self.version) >= "1.5": supported_os.append("Windows") return supported_os @@ -82,7 +83,7 @@ def validate(self): raise ConanInvalidConfiguration("upstream backward-cpp v{0} is not" " supported in {1}.".format(self.version, self.settings.os)) if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + tools.build.check_min_cppstd(self, 11) if self.settings.os == "Macos": if self.settings.arch == "armv8": raise ConanInvalidConfiguration("Macos M1 not supported yet") @@ -91,7 +92,7 @@ def validate(self): " is supported on Macos") def source(self): - tools.get(**self.conan_data["sources"][self.version], + tools.files.get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _configure_cmake(self): @@ -112,7 +113,7 @@ def _configure_cmake(self): def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + tools.files.patch(self, **patch) def build(self): self._patch_sources() @@ -123,7 +124,7 @@ def package(self): self.copy(pattern="LICENSE*", dst="licenses", src=self._source_subfolder) cmake = self._configure_cmake() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "backward")) + tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "backward")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Backward") @@ -138,7 +139,7 @@ def package_info(self): self.cpp_info.defines.append("BACKWARD_HAS_DWARF={}".format(int(self._has_stack_details("dwarf")))) self.cpp_info.defines.append("BACKWARD_HAS_PDB_SYMBOL={}".format(int(self.settings.os == "Windows"))) - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = tools.files.collect_libs(self, self) if self.settings.os == "Linux": self.cpp_info.system_libs.extend(["dl"]) if self.settings.os == "Windows": diff --git a/recipes/backward-cpp/all/test_package/conanfile.py b/recipes/backward-cpp/all/test_package/conanfile.py index 38f4483872d47..342d7348a4aa6 100644 --- a/recipes/backward-cpp/all/test_package/conanfile.py +++ b/recipes/backward-cpp/all/test_package/conanfile.py @@ -1,4 +1,5 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile, tools +from conans import CMake import os @@ -12,6 +13,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if not tools.build.cross_building(self, self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True)