1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-17 10:40:12 +02:00

config['sdk_path'] will never be None, behave properly if ANDROID_HOME is unset

This commit is contained in:
Daniel Martí 2014-09-15 12:49:36 +02:00
parent 37aa3a7b99
commit e038b4424c

View File

@ -195,32 +195,31 @@ def read_config(opts, config_file='config.py'):
return config
def test_sdk_exists(c):
if c['sdk_path'] is None:
# c['sdk_path'] is set to the value of ANDROID_HOME by default
def test_sdk_exists(config):
if config['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.:')
logging.error('\texport ANDROID_HOME=/opt/android-sdk')
return False
if not os.path.exists(c['sdk_path']):
logging.critical('Android SDK path "' + c['sdk_path'] + '" does not exist!')
if not os.path.exists(config['sdk_path']):
logging.critical('Android SDK path "' + config['sdk_path'] + '" does not exist!')
return False
if not os.path.isdir(c['sdk_path']):
logging.critical('Android SDK path "' + c['sdk_path'] + '" is not a directory!')
if not os.path.isdir(config['sdk_path']):
logging.critical('Android SDK path "' + config['sdk_path'] + '" is not a directory!')
return False
for d in ['build-tools', 'platform-tools', 'tools']:
if not os.path.isdir(os.path.join(c['sdk_path'], d)):
if not os.path.isdir(os.path.join(config['sdk_path'], d)):
logging.critical('Android SDK path "%s" does not contain "%s/"!' % (
c['sdk_path'], d))
config['sdk_path'], d))
return False
return True
def test_build_tools_exists(c):
if not test_sdk_exists(c):
def test_build_tools_exists(config):
if not test_sdk_exists(config):
return False
build_tools = os.path.join(c['sdk_path'], 'build-tools')
versioned_build_tools = os.path.join(build_tools, c['build_tools'])
build_tools = os.path.join(config['sdk_path'], 'build-tools')
versioned_build_tools = os.path.join(build_tools, config['build_tools'])
if not os.path.isdir(versioned_build_tools):
logging.critical('Android Build Tools path "'
+ versioned_build_tools + '" does not exist!')