do not set sdk_path in config.py if using system-provided aapt

By not setting sdk_path when /usr/bin/aapt is found, sdk_path then defaults
to $ANDROID_HOME when its used.  Since in this case, aapt will be used from
the system path, using aapt entirely ignores sdk_path.  If the user runs
`fdroid build` in this setup, sdk_path will be $ANDROID_HOME, so it should
check the env vars for it, but maybe that doesn't actually work like that
yet.
This commit is contained in:
Hans-Christoph Steiner 2014-12-09 15:20:29 +01:00
parent fa1cc48d57
commit 5f5bcd2e11
3 changed files with 35 additions and 25 deletions

View file

@ -169,7 +169,7 @@ def find_sdk_tools_cmd(cmd):
'''find a working path to a tool from the Android SDK'''
tooldirs = []
if 'sdk_path' in config and os.path.exists(config['sdk_path']):
if config is not None and 'sdk_path' in config and os.path.exists(config['sdk_path']):
# try to find a working path to this command, in all the recent possible paths
if 'build_tools' in config:
build_tools = os.path.join(config['sdk_path'], 'build-tools')
@ -199,8 +199,11 @@ def find_sdk_tools_cmd(cmd):
def test_sdk_exists(thisconfig):
if 'sdk_path' not in thisconfig:
logging.error("'sdk_path' not set in config.py!")
return False
if 'aapt' in thisconfig and os.path.isfile(thisconfig['aapt']):
return True
else:
logging.error("'sdk_path' not set in config.py!")
return False
if thisconfig['sdk_path'] == default_config['sdk_path']:
logging.error('No Android SDK found!')
logging.error('You can use ANDROID_HOME to set the path to your SDK, i.e.:')