Merge pull request #807 from inclement/respect_user_sdk_dir

Made buildozer respect user sdk dir when accessing sdkmanager
This commit is contained in:
Andre Miras 2019-02-02 15:41:46 +01:00 committed by GitHub
commit 63926eb981
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,12 +98,9 @@ class TargetAndroid(Target):
def _sdkmanager(self, *args, **kwargs):
"""Call the sdkmanager in our Android SDK with the given arguments."""
# Use the android-sdk dir as cwd by default
kwargs['cwd'] = kwargs.get(
'cwd', os.path.join(self.buildozer.global_platform_dir,
'android-sdk'))
kwargs['cwd'] = kwargs.get('cwd', self.android_sdk_dir)
sdkmanager_path = os.path.join(self.buildozer.global_platform_dir,
'android-sdk',
sdkmanager_path = os.path.join(self.android_sdk_dir,
'tools',
'bin',
'sdkmanager')
@ -120,7 +117,7 @@ class TargetAndroid(Target):
else:
kwargs['get_stdout'] = kwargs.get('get_stdout', True)
return self.buildozer.cmd(command, **kwargs)
@property
def android_ndk_version(self):
return self.buildozer.config.getdefault('app', 'android.ndk',
@ -422,7 +419,7 @@ class TargetAndroid(Target):
version = package_name.split(';')[1]
build_tools_versions.append(parse(version))
return build_tools_versions
def _android_get_installed_platform_tools_version(self):
@ -456,7 +453,7 @@ class TargetAndroid(Target):
revision = line.split('=')[1].strip()
return revision
def _android_update_sdk(self, *sdkmanager_commands):
"""Update the tools and package-tools if possible"""
@ -464,7 +461,7 @@ class TargetAndroid(Target):
auto_accept_license = self.buildozer.config.getdefault(
'app', 'android.accept_sdk_license', False)
if auto_accept_license:
java_tool_options = environ.get('JAVA_TOOL_OPTIONS', '')
env = os.environ.copy()
@ -484,7 +481,7 @@ class TargetAndroid(Target):
child.sendline('y')
else:
# the user will be prompted to read and accept the license
self._sdkmanager(*sdkmanager_commands)
self._sdkmanager(*sdkmanager_commands)
def _read_version_subdir(self, *args):
versions = []