From a3fb476a0fd7fb7fd3c0865672830d82f580cb87 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Thu, 10 Dec 2020 09:27:24 +0100 Subject: [PATCH 1/5] simplify min cppstd check --- recipes/entt/3.x.x/conanfile.py | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/recipes/entt/3.x.x/conanfile.py b/recipes/entt/3.x.x/conanfile.py index 1adf89b4f7a58..5693605032929 100644 --- a/recipes/entt/3.x.x/conanfile.py +++ b/recipes/entt/3.x.x/conanfile.py @@ -19,29 +19,8 @@ def _source_subfolder(self): return "source_subfolder" def configure(self): - minimal_cpp_standard = "17" if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - - minimal_version = { - "Visual Studio": "15.9", - "gcc": "7", - "clang": "5", - "apple-clang": "10" - } - - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - return - - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + tools.check_min_cppstd(self, "17") def package_id(self): self.info.header_only() From 4c369fede26e76a9833bfa06100c95678d7d6bb0 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Thu, 10 Dec 2020 10:53:35 +0100 Subject: [PATCH 2/5] use VisualStudio 15 as base reference --- recipes/entt/3.x.x/conanfile.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/recipes/entt/3.x.x/conanfile.py b/recipes/entt/3.x.x/conanfile.py index 5693605032929..e45a8b6098282 100644 --- a/recipes/entt/3.x.x/conanfile.py +++ b/recipes/entt/3.x.x/conanfile.py @@ -19,8 +19,33 @@ def _source_subfolder(self): return "source_subfolder" def configure(self): + # FIXME: Here we are implementing a workaround because ConanCenter is not generating any configuration with + # C++17 support (either supported by default by a compiler or using 'compiler.cppstd=17' in the Conan profile) + # and ConanCenter requires that at least one package is generated. Once, ConanCenter iterates a profile using + # with C++17 support, only a raw call to `tools.check_mis_cppstd(self, "17")` will be required. + minimal_cpp_standard = "17" if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "17") + tools.check_min_cppstd(self, minimal_cpp_standard) + + minimal_version = { + "Visual Studio": "15", + "gcc": "7", + "clang": "5", + "apple-clang": "10" + } + + compiler = str(self.settings.compiler) + if compiler not in minimal_version: + self.output.warn( + "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) + self.output.warn( + "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + return + + version = tools.Version(self.settings.compiler.version) + if version < minimal_version[compiler]: + raise ConanInvalidConfiguration( + "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) def package_id(self): self.info.header_only() From 7ee396e2ad5534984349e02d82cce182003f08ea Mon Sep 17 00:00:00 2001 From: jgsogo Date: Thu, 10 Dec 2020 11:55:24 +0100 Subject: [PATCH 3/5] assume minor version satisfies --- recipes/entt/3.x.x/conanfile.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/recipes/entt/3.x.x/conanfile.py b/recipes/entt/3.x.x/conanfile.py index e45a8b6098282..85bb0ad5dd534 100644 --- a/recipes/entt/3.x.x/conanfile.py +++ b/recipes/entt/3.x.x/conanfile.py @@ -21,14 +21,14 @@ def _source_subfolder(self): def configure(self): # FIXME: Here we are implementing a workaround because ConanCenter is not generating any configuration with # C++17 support (either supported by default by a compiler or using 'compiler.cppstd=17' in the Conan profile) - # and ConanCenter requires that at least one package is generated. Once, ConanCenter iterates a profile using + # and ConanCenter requires that at least one package is generated. Once ConanCenter uses a profile # with C++17 support, only a raw call to `tools.check_mis_cppstd(self, "17")` will be required. minimal_cpp_standard = "17" if self.settings.compiler.cppstd: tools.check_min_cppstd(self, minimal_cpp_standard) minimal_version = { - "Visual Studio": "15", + "Visual Studio": "15.9", "gcc": "7", "clang": "5", "apple-clang": "10" @@ -42,8 +42,15 @@ def configure(self): "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) return - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: + # Compare versions asuming minor satisfies if not explicitly set + def gte_compiler_version(version1, version2): + v1, *v1_res = version1.split(".", 1) + v2, *v2_res = version2.split(".", 1) + if v1 == v2 and v1_res and v2_res: + return gte_compiler_version(v1_res, v2_res) + return v1 >= v2 + + if not gte_compiler_version(str(self.settings.compiler.version), minimal_version[compiler]): raise ConanInvalidConfiguration( "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) From f618a70ef5033ae294936e2feb90b425f664fa80 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Fri, 11 Dec 2020 08:48:30 +0100 Subject: [PATCH 4/5] Update recipes/entt/3.x.x/conanfile.py Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/entt/3.x.x/conanfile.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/recipes/entt/3.x.x/conanfile.py b/recipes/entt/3.x.x/conanfile.py index 85bb0ad5dd534..96edc928377ce 100644 --- a/recipes/entt/3.x.x/conanfile.py +++ b/recipes/entt/3.x.x/conanfile.py @@ -43,14 +43,13 @@ def configure(self): return # Compare versions asuming minor satisfies if not explicitly set - def gte_compiler_version(version1, version2): - v1, *v1_res = version1.split(".", 1) - v2, *v2_res = version2.split(".", 1) - if v1 == v2 and v1_res and v2_res: - return gte_compiler_version(v1_res, v2_res) - return v1 >= v2 + def lazy_lt_semver(v1, v2): + lv1 = v1.split(".") + lv2 = v2.split(".") + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] - if not gte_compiler_version(str(self.settings.compiler.version), minimal_version[compiler]): + if lazy_lt_semver(str(self.settings.compiler.version), minimal_version[compiler]): raise ConanInvalidConfiguration( "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) From 761799ecb46ca64707571d5b97d8d29d21811aa1 Mon Sep 17 00:00:00 2001 From: jgsogo Date: Sat, 12 Dec 2020 18:33:19 +0100 Subject: [PATCH 5/5] remove opinionated fixme, cast to int --- recipes/entt/3.x.x/conanfile.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/recipes/entt/3.x.x/conanfile.py b/recipes/entt/3.x.x/conanfile.py index 96edc928377ce..27a64a42552dc 100644 --- a/recipes/entt/3.x.x/conanfile.py +++ b/recipes/entt/3.x.x/conanfile.py @@ -19,10 +19,6 @@ def _source_subfolder(self): return "source_subfolder" def configure(self): - # FIXME: Here we are implementing a workaround because ConanCenter is not generating any configuration with - # C++17 support (either supported by default by a compiler or using 'compiler.cppstd=17' in the Conan profile) - # and ConanCenter requires that at least one package is generated. Once ConanCenter uses a profile - # with C++17 support, only a raw call to `tools.check_mis_cppstd(self, "17")` will be required. minimal_cpp_standard = "17" if self.settings.compiler.cppstd: tools.check_min_cppstd(self, minimal_cpp_standard) @@ -44,8 +40,8 @@ def configure(self): # Compare versions asuming minor satisfies if not explicitly set def lazy_lt_semver(v1, v2): - lv1 = v1.split(".") - lv2 = v2.split(".") + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length]