|
| 1 | +from conan import ConanFile |
| 2 | +from conan.errors import ConanInvalidConfiguration |
| 3 | +from conan.tools.build import check_min_cppstd |
| 4 | +from conan.tools.files import copy, download, get |
| 5 | +from conan.tools.layout import basic_layout |
1 | 6 | import os
|
2 |
| -from conans import ConanFile, tools |
3 |
| -from conans.errors import ConanInvalidConfiguration |
4 | 7 |
|
5 |
| -required_conan_version = ">=1.33.0" |
| 8 | +required_conan_version = ">=1.50.0" |
| 9 | + |
6 | 10 |
|
7 | 11 | class LupleConan(ConanFile):
|
8 | 12 | name = "luple"
|
9 | 13 | license = "Unlicense"
|
10 | 14 | url = "https://github.com/conan-io/conan-center-index"
|
11 | 15 | homepage = "https://github.com/alexpolt/luple"
|
12 | 16 | description = "Home to luple, nuple, C++ String Interning, Struct Reader and C++ Type Loophole"
|
13 |
| - topics = ("conan", "loophole", "luple", "nuple", "struct", "intern") |
14 |
| - settings = "compiler" |
| 17 | + topics = ("loophole", "luple", "nuple", "struct", "intern") |
| 18 | + settings = "os", "arch", "compiler", "build_type" |
15 | 19 | no_copy_source = True
|
16 | 20 |
|
17 |
| - def validate(self): |
18 |
| - minimal_cpp_standard = "14" |
19 |
| - if self.settings.compiler.cppstd: |
20 |
| - tools.check_min_cppstd(self, minimal_cpp_standard) |
21 |
| - minimal_version = { |
| 21 | + @property |
| 22 | + def _min_cppstd(self): |
| 23 | + return "14" |
| 24 | + |
| 25 | + @property |
| 26 | + def _compilers_minimum_version(self): |
| 27 | + return { |
22 | 28 | "gcc": "5",
|
23 | 29 | "clang": "3.4",
|
24 | 30 | "apple-clang": "10",
|
25 |
| - "Visual Studio": "14" |
| 31 | + "Visual Studio": "14", |
| 32 | + "msvc": "190", |
26 | 33 | }
|
27 |
| - compiler = str(self.settings.compiler) |
28 |
| - if compiler not in minimal_version: |
29 |
| - self.output.warn( |
30 |
| - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) |
31 |
| - self.output.warn( |
32 |
| - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) |
33 |
| - return |
34 |
| - version = tools.Version(self.settings.compiler.version) |
35 |
| - if version < minimal_version[compiler]: |
36 |
| - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) |
| 34 | + |
| 35 | + def layout(self): |
| 36 | + basic_layout(self, src_folder="src") |
| 37 | + |
| 38 | + def package_id(self): |
| 39 | + self.info.clear() |
| 40 | + |
| 41 | + def validate(self): |
| 42 | + if self.settings.compiler.get_safe("cppstd"): |
| 43 | + check_min_cppstd(self, self._min_cppstd) |
| 44 | + |
| 45 | + def loose_lt_semver(v1, v2): |
| 46 | + lv1 = [int(v) for v in v1.split(".")] |
| 47 | + lv2 = [int(v) for v in v2.split(".")] |
| 48 | + min_length = min(len(lv1), len(lv2)) |
| 49 | + return lv1[:min_length] < lv2[:min_length] |
| 50 | + |
| 51 | + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) |
| 52 | + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): |
| 53 | + raise ConanInvalidConfiguration( |
| 54 | + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", |
| 55 | + ) |
37 | 56 |
|
38 | 57 | def source(self):
|
39 |
| - tools.get(**self.conan_data["sources"][self.version][0], strip_root=True) |
40 |
| - tools.download(filename="LICENSE", **self.conan_data["sources"][self.version][1]) |
| 58 | + get(self, **self.conan_data["sources"][self.version][0], |
| 59 | + destination=self.source_folder, strip_root=True) |
| 60 | + download(self, filename="LICENSE", **self.conan_data["sources"][self.version][1]) |
41 | 61 |
|
42 |
| - def package(self): |
43 |
| - self.copy("LICENSE", dst="licenses") |
44 |
| - self.copy("*.h", dst="include") |
| 62 | + def build(self): |
| 63 | + pass |
45 | 64 |
|
46 |
| - def package_id(self): |
47 |
| - self.info.header_only() |
| 65 | + def package(self): |
| 66 | + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) |
| 67 | + copy(self, "*.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) |
48 | 68 |
|
49 | 69 | def package_info(self):
|
| 70 | + self.cpp_info.bindirs = [] |
50 | 71 | self.cpp_info.libdirs = []
|
0 commit comments