forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'conan-io:master' into autoconf-conan-v2
- Loading branch information
Showing
249 changed files
with
3,898 additions
and
1,603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
name: docs_markdown_toc | ||
on: | ||
workflow_dispatch: | ||
inputs: {} | ||
push: | ||
branches: | ||
- master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import re | ||
from email.mime import base | ||
from pylint.checkers import BaseChecker | ||
from pylint.interfaces import IAstroidChecker | ||
from astroid import nodes, Const, AssignName | ||
|
||
|
||
class ImportTools(BaseChecker): | ||
""" | ||
Import tools following pattern 'from conan.tools.xxxx import yyyyy' | ||
""" | ||
|
||
__implements__ = IAstroidChecker | ||
|
||
name = "conan-import-tools" | ||
msgs = { | ||
"E9011": ( | ||
"Import tools following pattern 'from conan.tools.xxxx import yyyyy' (https://docs.conan.io/en/latest/reference/conanfile/tools.html).", | ||
"conan-import-tools", | ||
"Import tools following pattern 'from conan.tools.xxxx import yyyyy' (https://docs.conan.io/en/latest/reference/conanfile/tools.html).", | ||
), | ||
} | ||
|
||
def visit_importfrom(self, node: nodes.ImportFrom) -> None: | ||
basename = node.modname | ||
names = [name for name, _ in node.names] | ||
if basename == 'conan' and 'tools' in names: | ||
self.add_message("conan-import-tools", node=node) | ||
elif re.match(r'conan\.tools\.[^.]+\..+', basename): | ||
self.add_message("conan-import-tools", node=node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,73 @@ | ||
from conans import ConanFile, tools | ||
from conan import ConanFile | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.files import copy, get, save | ||
from conan.tools.layout import basic_layout | ||
import os | ||
import textwrap | ||
|
||
required_conan_version = ">=1.50.0" | ||
|
||
|
||
class ArgparseConan(ConanFile): | ||
name = "argh" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/adishavit/argh" | ||
topics = ("conan", "argh", "argument", "parsing") | ||
topics = ("argh", "argument", "parsing") | ||
license = "BSD-3" | ||
description = "Frustration-free command line processing" | ||
settings = "compiler" | ||
settings = "os", "arch", "compiler", "build_type" | ||
no_copy_source = True | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return os.path.join(self.source_folder, "source_subfolder") | ||
def package_id(self): | ||
self.info.clear() | ||
|
||
def validate(self): | ||
if self.settings.compiler.cppstd: | ||
tools.check_min_cppstd(self, 11) | ||
if self.settings.compiler.get_safe("cppstd"): | ||
check_min_cppstd(self, 11) | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
os.rename("argh-{}".format(self.version), self._source_subfolder) | ||
get(self, **self.conan_data["sources"][self.version], | ||
destination=self.source_folder, strip_root=True) | ||
|
||
def build(self): | ||
pass | ||
|
||
def package(self): | ||
self.copy("LICENSE", src=self._source_subfolder, dst="licenses") | ||
self.copy("argh.h", src=self._source_subfolder, dst=os.path.join("include", "argh")) | ||
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) | ||
copy(self, "argh.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) | ||
|
||
def package_id(self): | ||
self.info.header_only() | ||
# TODO: to remove in conan v2 once cmake_find_package* generators removed | ||
self._create_cmake_module_alias_targets( | ||
os.path.join(self.package_folder, self._module_file_rel_path), | ||
{"argh": "argh::argh"}, | ||
) | ||
|
||
def _create_cmake_module_alias_targets(self, module_file, targets): | ||
content = "" | ||
for alias, aliased in targets.items(): | ||
content += textwrap.dedent(f"""\ | ||
if(TARGET {aliased} AND NOT TARGET {alias}) | ||
add_library({alias} INTERFACE IMPORTED) | ||
set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) | ||
endif() | ||
""") | ||
save(self, module_file, content) | ||
|
||
@property | ||
def _module_file_rel_path(self): | ||
return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") | ||
|
||
def package_info(self): | ||
self.cpp_info.includedirs.append(os.path.join("include", "argh")) | ||
self.cpp_info.set_property("cmake_file_name", "argh") | ||
self.cpp_info.set_property("cmake_target_name", "argh") | ||
self.cpp_info.bindirs = [] | ||
self.cpp_info.frameworkdirs = [] | ||
self.cpp_info.libdirs = [] | ||
self.cpp_info.resdirs = [] | ||
|
||
# TODO: to remove in conan v2 once legacy generators removed | ||
self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] | ||
self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
cmake_minimum_required(VERSION 3.8) | ||
project(test_package LANGUAGES CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
find_package(argh REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE argh) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import CMake, cmake_layout | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
self.run(os.path.join("bin", "test_package")) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(test_package LANGUAGES CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(argh REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE argh) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
self.run(os.path.join("bin", "test_package")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(argparse REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} argparse::argparse) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE argparse::argparse) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) |
Oops, something went wrong.