mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-16 16:02:33 +03:00
config['sdk_path'] will never be None, behave properly if ANDROID_HOME is unset
This commit is contained in:
parent
37aa3a7b99
commit
e038b4424c
1 changed files with 12 additions and 13 deletions
|
@ -195,32 +195,31 @@ def read_config(opts, config_file='config.py'):
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
def test_sdk_exists(c):
|
def test_sdk_exists(config):
|
||||||
if c['sdk_path'] is None:
|
if config['sdk_path'] == default_config['sdk_path']:
|
||||||
# c['sdk_path'] is set to the value of ANDROID_HOME by default
|
|
||||||
logging.error('No Android SDK found!')
|
logging.error('No Android SDK found!')
|
||||||
logging.error('You can use ANDROID_HOME to set the path to your SDK, i.e.:')
|
logging.error('You can use ANDROID_HOME to set the path to your SDK, i.e.:')
|
||||||
logging.error('\texport ANDROID_HOME=/opt/android-sdk')
|
logging.error('\texport ANDROID_HOME=/opt/android-sdk')
|
||||||
return False
|
return False
|
||||||
if not os.path.exists(c['sdk_path']):
|
if not os.path.exists(config['sdk_path']):
|
||||||
logging.critical('Android SDK path "' + c['sdk_path'] + '" does not exist!')
|
logging.critical('Android SDK path "' + config['sdk_path'] + '" does not exist!')
|
||||||
return False
|
return False
|
||||||
if not os.path.isdir(c['sdk_path']):
|
if not os.path.isdir(config['sdk_path']):
|
||||||
logging.critical('Android SDK path "' + c['sdk_path'] + '" is not a directory!')
|
logging.critical('Android SDK path "' + config['sdk_path'] + '" is not a directory!')
|
||||||
return False
|
return False
|
||||||
for d in ['build-tools', 'platform-tools', 'tools']:
|
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/"!' % (
|
logging.critical('Android SDK path "%s" does not contain "%s/"!' % (
|
||||||
c['sdk_path'], d))
|
config['sdk_path'], d))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def test_build_tools_exists(c):
|
def test_build_tools_exists(config):
|
||||||
if not test_sdk_exists(c):
|
if not test_sdk_exists(config):
|
||||||
return False
|
return False
|
||||||
build_tools = os.path.join(c['sdk_path'], 'build-tools')
|
build_tools = os.path.join(config['sdk_path'], 'build-tools')
|
||||||
versioned_build_tools = os.path.join(build_tools, c['build_tools'])
|
versioned_build_tools = os.path.join(build_tools, config['build_tools'])
|
||||||
if not os.path.isdir(versioned_build_tools):
|
if not os.path.isdir(versioned_build_tools):
|
||||||
logging.critical('Android Build Tools path "'
|
logging.critical('Android Build Tools path "'
|
||||||
+ versioned_build_tools + '" does not exist!')
|
+ versioned_build_tools + '" does not exist!')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue