Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate backward-cpp to conan v2 #12499

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions recipes/backward-cpp/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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")
Expand All @@ -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):
Expand All @@ -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()
Expand All @@ -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")
Expand All @@ -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":
Expand Down
5 changes: 3 additions & 2 deletions recipes/backward-cpp/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from conans import ConanFile, CMake, tools
from conan import ConanFile, tools
from conans import CMake
import os


Expand All @@ -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)