Added auto_accept_license option

This commit is contained in:
Alexander Taylor 2019-02-01 15:30:23 +00:00
parent 165dde84b1
commit 07c8b9ec8e
2 changed files with 30 additions and 16 deletions

View file

@ -119,6 +119,12 @@ fullscreen = 0
# when an update is due and you just want to test/build your package
# android.skip_update = False
# (bool) If True, then automatically accept SDK license
# agreements. This is intended for automation only. If set to False,
# the default, you will be shown the license when first running
# buildozer.
# android.accept_sdk_license = False
# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity

View file

@ -413,22 +413,30 @@ class TargetAndroid(Target):
def _android_update_sdk(self, *sdkmanager_commands):
"""Update the tools and package-tools if possible"""
from pexpect import EOF
java_tool_options = environ.get('JAVA_TOOL_OPTIONS', '')
env = os.environ.copy()
env.update({
'JAVA_TOOL_OPTIONS': java_tool_options +
' -Dfile.encoding=UTF-8'
})
child = self._sdkmanager(
*sdkmanager_commands,
timeout=None,
return_child=True,
env=env)
while True:
index = child.expect([EOF, u'\(y/N\): '])
if index == 0:
break
child.sendline('y')
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()
env.update({
'JAVA_TOOL_OPTIONS': java_tool_options +
' -Dfile.encoding=UTF-8'
})
child = self._sdkmanager(
*sdkmanager_commands,
timeout=None,
return_child=True,
env=env)
while True:
index = child.expect([EOF, u'\(y/N\): '])
if index == 0:
break
child.sendline('y')
else:
# the user will be prompted to read and accept the license
self._sdkmanager(*sdkmanager_commands)
def _read_version_subdir(self, *args):
versions = []