mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-08-15 02:58:22 +00:00
(#13331) [docs] Apply python black formatter over recipe templates
* Apply python black Signed-off-by: Uilian Ries <uilianries@gmail.com> * Update to 120 chars Signed-off-by: Uilian Ries <uilianries@gmail.com> * Update to 120 chars Signed-off-by: Uilian Ries <uilianries@gmail.com> Signed-off-by: Uilian Ries <uilianries@gmail.com>
This commit is contained in:
@@ -12,10 +12,13 @@ required_conan_version = ">=1.52.0"
|
||||
class PackageConan(ConanFile):
|
||||
name = "package"
|
||||
description = "short description"
|
||||
license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/
|
||||
# Use short name only, conform to SPDX License List: https://spdx.org/licenses/
|
||||
# In case not listed there, use "LicenseRef-<license-file-name>"
|
||||
license = ""
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://github.com/project/package"
|
||||
topics = ("topic1", "topic2", "topic3") # no "conan" and project name in topics
|
||||
# no "conan" and project name in topics. Use topics from the upstream listed on GH
|
||||
topics = ("topic1", "topic2", "topic3")
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
@@ -38,23 +41,27 @@ class PackageConan(ConanFile):
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
try:
|
||||
del self.options.fPIC # once removed by config_options, need try..except for a second del
|
||||
# once removed by config_options, need try..except for a second del
|
||||
del self.options.fPIC
|
||||
except Exception:
|
||||
pass
|
||||
# for plain C projects only
|
||||
try:
|
||||
del self.settings.compiler.libcxx # for plain C projects only
|
||||
del self.settings.compiler.libcxx
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
del self.settings.compiler.cppstd # for plain C projects only
|
||||
del self.settings.compiler.cppstd
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def layout(self):
|
||||
vs_layout(self, src_folder="src") # src_folder must use the same source folder name the project
|
||||
# src_folder must use the same source folder name the project
|
||||
vs_layout(self, src_folder="src")
|
||||
|
||||
def requirements(self):
|
||||
self.requires("dependency/0.8.1") # prefer self.requires method instead of requires attribute
|
||||
# prefer self.requires method instead of requires attribute
|
||||
self.requires("dependency/0.8.1")
|
||||
|
||||
def validate(self):
|
||||
# in case it does not work in another configuration, it should validated here too
|
||||
@@ -66,8 +73,7 @@ class PackageConan(ConanFile):
|
||||
self.tool_requires("tool/x.y.z")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version],
|
||||
destination=self.source_folder, strip_root=True)
|
||||
get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = MSBuildToolchain(self)
|
||||
@@ -81,15 +87,10 @@ class PackageConan(ConanFile):
|
||||
apply_conandata_patches(self)
|
||||
# remove bundled xxhash
|
||||
rm(self, "whateer.*", os.path.join(self.source_folder, "lib"))
|
||||
replace_in_file(
|
||||
self,
|
||||
os.path.join(self.source_folder, "CMakeLists.txt"),
|
||||
"...",
|
||||
"",
|
||||
)
|
||||
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "...", "")
|
||||
|
||||
def build(self):
|
||||
self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed
|
||||
self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed
|
||||
msbuild = MSBuild(self)
|
||||
# customize to Release when RelWithDebInfo
|
||||
msbuild.build_type = "Debug" if self.settings.build_type == "Debug" else "Release"
|
||||
@@ -100,9 +101,18 @@ class PackageConan(ConanFile):
|
||||
|
||||
def package(self):
|
||||
copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
|
||||
copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False)
|
||||
copy(self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False)
|
||||
copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include"))
|
||||
copy(
|
||||
self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False
|
||||
)
|
||||
copy(
|
||||
self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False
|
||||
)
|
||||
copy(
|
||||
self,
|
||||
pattern="*.h",
|
||||
dst=os.path.join(self.package_folder, "include"),
|
||||
src=os.path.join(self.source_folder, "include"),
|
||||
)
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ["package_lib"]
|
||||
|
Reference in New Issue
Block a user