chiark / gitweb /
config['sdk_path'] will never be None, behave properly if ANDROID_HOME is unset
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 15 Sep 2014 10:49:36 +0000 (12:49 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Mon, 15 Sep 2014 10:49:36 +0000 (12:49 +0200)
fdroidserver/common.py

index 52a3bf72be951ad906285523b5fae6d0033ade14..ba8080a70778ed7cf6668079f95b12363113c914 100644 (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!')