From 3028116c3955eabdc8f3e51a385e490e51cec781 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Fri, 18 Oct 2019 10:10:41 -0300 Subject: [PATCH 1/3] #108 use cpp_info.frameworks instead of cpp_info.exe_link_flags Signed-off-by: Uilian Ries --- hooks/conan-center.py | 9 ++++++- .../conan-center/test_conan-center.py | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/hooks/conan-center.py b/hooks/conan-center.py index 442141e5..84fbe0b1 100644 --- a/hooks/conan-center.py +++ b/hooks/conan-center.py @@ -32,7 +32,9 @@ "KB-H025": "META LINES", "KB-H027": "CONAN CENTER INDEX URL", "KB-H028": "CMAKE MINIMUM VERSION", - "KB-H029": "TEST PACKAGE - RUN ENVIRONMENT"} + "KB-H029": "TEST PACKAGE - RUN ENVIRONMENT", + "KB-H032": "APPLE FRAMEWORK" + } class _HooksOutputErrorCollector(object): @@ -267,6 +269,11 @@ def test(out): out.error("The 'RunEnvironment()' build helper is no longer needed. " "It has been integrated into the self.run(..., run_environment=True)") + @run_test("KB-H032", output) + def test(out): + if "cpp_info.shared_link_flags" in conanfile_content and "-framework" in conanfile_content: + out.error("Apple Frameworks should be packaged using 'self.cpp_info.frameworks'") + @raise_if_error_output def pre_source(output, conanfile, conanfile_path, **kwargs): diff --git a/tests/test_hooks/conan-center/test_conan-center.py b/tests/test_hooks/conan-center/test_conan-center.py index f4f97466..86a1a3de 100644 --- a/tests/test_hooks/conan-center/test_conan-center.py +++ b/tests/test_hooks/conan-center/test_conan-center.py @@ -399,3 +399,27 @@ def test_cmake_minimum_verstion(self): self.assertIn("ERROR: [CMAKE MINIMUM VERSION (KB-H028)] The CMake file '%s' must contain a " "minimum version declared (e.g. cmake_minimum_required(VERSION 3.1.2))" % path, output) + + def test_apple_frameworks(self): + conanfile = textwrap.dedent("""\ + from conans import ConanFile + class AConan(ConanFile): + url = "https://github.com/conan-io/conan-center-index" + license = "fake_license" + description = "whatever" + exports_sources = "header.h" + def package(self): + self.copy("*", dst="include") + def cpp_info(self): + self.cpp_info.""") + + inv_conanfile = conanfile + 'shared_link_flags.append("-framework CoreAudio")' + tools.save('conanfile.py', content=inv_conanfile) + output = self.conan(['create', '.', 'name/version@user/test']) + self.assertIn("ERROR: [APPLE FRAMEWORK (KB-H032)] Apple Frameworks should be packaged " \ + "using 'self.cpp_info.frameworks'", output) + + val_conanfile = conanfile + 'frameworks.append("CoreAudio")' + tools.save('conanfile.py', content=val_conanfile) + output = self.conan(['create', '.', 'name/version@user/test']) + self.assertIn("[APPLE FRAMEWORK (KB-H032)] OK", output) From 31d481ece2cd04dd9fd785dbd60e12738af3aeab Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 30 Oct 2019 15:42:06 -0300 Subject: [PATCH 2/3] #108 Fix KB number for osx tests Signed-off-by: Uilian Ries --- tests/test_hooks/conan-center/test_conan-center.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_hooks/conan-center/test_conan-center.py b/tests/test_hooks/conan-center/test_conan-center.py index 86a1a3de..e0552cdc 100644 --- a/tests/test_hooks/conan-center/test_conan-center.py +++ b/tests/test_hooks/conan-center/test_conan-center.py @@ -416,10 +416,10 @@ def cpp_info(self): inv_conanfile = conanfile + 'shared_link_flags.append("-framework CoreAudio")' tools.save('conanfile.py', content=inv_conanfile) output = self.conan(['create', '.', 'name/version@user/test']) - self.assertIn("ERROR: [APPLE FRAMEWORK (KB-H032)] Apple Frameworks should be packaged " \ + self.assertIn("ERROR: [APPLE FRAMEWORK (KB-H033)] Apple Frameworks should be packaged " \ "using 'self.cpp_info.frameworks'", output) val_conanfile = conanfile + 'frameworks.append("CoreAudio")' tools.save('conanfile.py', content=val_conanfile) output = self.conan(['create', '.', 'name/version@user/test']) - self.assertIn("[APPLE FRAMEWORK (KB-H032)] OK", output) + self.assertIn("[APPLE FRAMEWORK (KB-H033)] OK", output) From 22c39548f760bdbc8c59b8fb0aec0e55e90e7398 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Fri, 1 Nov 2019 16:02:17 -0300 Subject: [PATCH 3/3] #108 Try to avoid git conflict Signed-off-by: Uilian Ries --- hooks/conan-center.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hooks/conan-center.py b/hooks/conan-center.py index c51324f3..6f5f261a 100644 --- a/hooks/conan-center.py +++ b/hooks/conan-center.py @@ -38,7 +38,8 @@ "KB-H029": "TEST PACKAGE - RUN ENVIRONMENT", "KB-H030": "CONANDATA.YML FORMAT", "KB-H031": "CONANDATA.YML REDUCE", - "KB-H033": "APPLE FRAMEWORK"} + "KB-H033": "APPLE FRAMEWORK", + } class _HooksOutputErrorCollector(object):