diff --git a/recipes/android-ndk/all/conanfile.py b/recipes/android-ndk/all/conanfile.py index d19af16d49b4ef..15dbb061265c45 100644 --- a/recipes/android-ndk/all/conanfile.py +++ b/recipes/android-ndk/all/conanfile.py @@ -2,6 +2,8 @@ from conans.errors import ConanInvalidConfiguration import os +required_conan_version = ">=1.33.0" + class AndroidNDKConan(ConanFile): name = "android-ndk" @@ -22,18 +24,10 @@ def _source_subfolder(self): return "source_subfolder" def _settings_os_supported(self): - try: - self.conan_data["sources"][self.version][str(self.settings.os)] - return True - except KeyError: - return False + return self.conan_data["sources"][self.version].get[str(self.settings.os) is not None def _settings_arch_supported(self): - try: - self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)] - return True - except KeyError: - return False + return self.conan_data["sources"][self.version].get(str(self.settings.os), {}).get(str(self.settings.arch)) is not None def validate(self): if not self._settings_os_supported(): @@ -45,6 +39,14 @@ def build(self): tools.get(**self.conan_data["sources"][self.version]["url"][str(self.settings.os)][str(self.settings.arch)], destination=self._source_subfolder, strip_root=True) + def package(self): + self.copy("*", src=self._source_subfolder, dst=".", keep_path=True, symlinks=True) + self.copy("*NOTICE", src=self._source_subfolder, dst="licenses") + self.copy("*NOTICE.toolchain", src=self._source_subfolder, dst="licenses") + self.copy("cmake-wrapper.cmd") + self.copy("cmake-wrapper") + self._fix_permissions() + # from here on, everything is assumed to run in 2 profile mode, using this android-ndk recipe as a build requirement @property @@ -113,14 +115,6 @@ def _fix_permissions(self): self.output.info(f"chmod on Mach-O file: '{filename}'") self._chmod_plus_x(filename) - def package(self): - self.copy("*", src=self._source_subfolder, dst=".", keep_path=True, symlinks=True) - self.copy("*NOTICE", src=self._source_subfolder, dst="licenses") - self.copy("*NOTICE.toolchain", src=self._source_subfolder, dst="licenses") - self.copy("cmake-wrapper.cmd") - self.copy("cmake-wrapper") - self._fix_permissions() - @property def _host(self): return f"{self._platform}_{self.settings.arch}"