From: Daniel Martí Date: Mon, 15 Sep 2014 10:49:36 +0000 (+0200) Subject: config['sdk_path'] will never be None, behave properly if ANDROID_HOME is unset X-Git-Tag: 0.3.0~57 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e038b4424c9ad2e933e42d23a80a072975f431e2;p=fdroidserver.git config['sdk_path'] will never be None, behave properly if ANDROID_HOME is unset --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 52a3bf72..ba8080a7 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -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!')