Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made buildozer respect user sdk dir when accessing sdkmanager #807

Merged
merged 1 commit into from
Feb 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,9 @@ def _p4a(self, cmd, **kwargs):
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')
Expand All @@ -120,7 +117,7 @@ def _sdkmanager(self, *args, **kwargs):
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',
Expand Down Expand Up @@ -422,7 +419,7 @@ def _android_list_build_tools_versions(self):
version = package_name.split(';')[1]

build_tools_versions.append(parse(version))

return build_tools_versions

def _android_get_installed_platform_tools_version(self):
Expand Down Expand Up @@ -456,15 +453,15 @@ def _android_get_installed_platform_tools_version(self):
revision = line.split('=')[1].strip()

return revision


def _android_update_sdk(self, *sdkmanager_commands):
"""Update the tools and package-tools if possible"""
from pexpect import EOF

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()
Expand All @@ -484,7 +481,7 @@ def _android_update_sdk(self, *sdkmanager_commands):
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 = []
Expand Down