Skip to content

Commit

Permalink
android-ndk: avoid warning in os/arch validation
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr committed Oct 1, 2021
1 parent 32d3210 commit cf57c4e
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions recipes/android-ndk/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from conans.errors import ConanInvalidConfiguration
import os

required_conan_version = ">=1.33.0"


class AndroidNDKConan(ConanFile):
name = "android-ndk"
Expand All @@ -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():
Expand All @@ -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
Expand Down Expand Up @@ -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}"
Expand Down

0 comments on commit cf57c4e

Please sign in to comment.