chiark / gitweb /
Find aapt as part of the main config initialisation
authorDaniel Martí <mvdan@mvdan.cc>
Wed, 2 Jul 2014 22:27:44 +0000 (00:27 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Wed, 2 Jul 2014 22:31:07 +0000 (00:31 +0200)
fdroidserver/build.py
fdroidserver/common.py
fdroidserver/update.py

index 3c3b96f9223ecd4ad7c1bc28b4da1f4574c506e2..664177a54b4190fc6b06f358e0a0f106ffc33935 100644 (file)
@@ -772,9 +772,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
     if not os.path.exists(src):
         raise BuildException("Unsigned apk is not at expected location of " + src)
 
-    p = SilentPopen([os.path.join(config['sdk_path'], 'build-tools',
-                                  config['build_tools'], 'aapt'),
-                     'dump', 'badging', src])
+    p = SilentPopen([config['aapt'], 'dump', 'badging', src])
 
     vercode = None
     version = None
index db885a0354aa59664d59dbd933daca95fedd1746..949fdd1d687fe3e045595601ca17ff2bccfcb898 100644 (file)
@@ -125,10 +125,25 @@ def read_config(opts, config_file='config.py'):
     if not test_build_tools_exists(config):
         sys.exit(3)
 
-    env = os.environ
+    bin_paths = {
+        'aapt': [
+            os.path.join(config['sdk_path'], 'build-tools', config['build_tools'], 'aapt'),
+            ]
+        }
+
+    for b, paths in bin_paths.items():
+        config[b] = None
+        for path in paths:
+            if os.path.isfile(path):
+                config[b] = path
+                break
+        if config[b] is None:
+            logging.warn("Could not find %s in any of the following paths:\n%s" % (
+                b, '\n'.join(paths)))
 
     # There is no standard, so just set up the most common environment
     # variables
+    env = os.environ
     for n in ['ANDROID_HOME', 'ANDROID_SDK']:
         env[n] = config['sdk_path']
     for n in ['ANDROID_NDK', 'NDK']:
@@ -176,11 +191,6 @@ def test_build_tools_exists(c):
         logging.critical('Android Build Tools path "'
                          + versioned_build_tools + '" does not exist!')
         return False
-    if not os.path.exists(os.path.join(c['sdk_path'], 'build-tools', c['build_tools'], 'aapt')):
-        logging.critical('Android Build Tools "'
-                         + versioned_build_tools
-                         + '" does not contain "aapt"!')
-        return False
     return True
 
 
index 54ce4b61497d7f7c45a472d8635ea7db4cb53b05..a1955e5b7ed765c219016590d1f4db40d8aaf44c 100644 (file)
@@ -374,9 +374,7 @@ def scan_apks(apps, apkcache, repodir, knownapks):
             thisinfo['features'] = []
             thisinfo['icons_src'] = {}
             thisinfo['icons'] = {}
-            p = SilentPopen([os.path.join(config['sdk_path'], 'build-tools',
-                                          config['build_tools'], 'aapt'),
-                             'dump', 'badging', apkfile])
+            p = SilentPopen([config['aapt'], 'dump', 'badging', apkfile])
             if p.returncode != 0:
                 if options.delete_unknown:
                     if os.path.exists(apkfile):