Find aapt as part of the main config initialisation

This commit is contained in:
Daniel Martí 2014-07-03 00:27:44 +02:00
parent 5aad7b5d38
commit d110c24eff
3 changed files with 18 additions and 12 deletions

View 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): if not os.path.exists(src):
raise BuildException("Unsigned apk is not at expected location of " + src) raise BuildException("Unsigned apk is not at expected location of " + src)
p = SilentPopen([os.path.join(config['sdk_path'], 'build-tools', p = SilentPopen([config['aapt'], 'dump', 'badging', src])
config['build_tools'], 'aapt'),
'dump', 'badging', src])
vercode = None vercode = None
version = None version = None

View file

@ -125,10 +125,25 @@ def read_config(opts, config_file='config.py'):
if not test_build_tools_exists(config): if not test_build_tools_exists(config):
sys.exit(3) 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 # There is no standard, so just set up the most common environment
# variables # variables
env = os.environ
for n in ['ANDROID_HOME', 'ANDROID_SDK']: for n in ['ANDROID_HOME', 'ANDROID_SDK']:
env[n] = config['sdk_path'] env[n] = config['sdk_path']
for n in ['ANDROID_NDK', 'NDK']: for n in ['ANDROID_NDK', 'NDK']:
@ -176,11 +191,6 @@ def test_build_tools_exists(c):
logging.critical('Android Build Tools path "' logging.critical('Android Build Tools path "'
+ versioned_build_tools + '" does not exist!') + versioned_build_tools + '" does not exist!')
return False 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 return True

View file

@ -374,9 +374,7 @@ def scan_apks(apps, apkcache, repodir, knownapks):
thisinfo['features'] = [] thisinfo['features'] = []
thisinfo['icons_src'] = {} thisinfo['icons_src'] = {}
thisinfo['icons'] = {} thisinfo['icons'] = {}
p = SilentPopen([os.path.join(config['sdk_path'], 'build-tools', p = SilentPopen([config['aapt'], 'dump', 'badging', apkfile])
config['build_tools'], 'aapt'),
'dump', 'badging', apkfile])
if p.returncode != 0: if p.returncode != 0:
if options.delete_unknown: if options.delete_unknown:
if os.path.exists(apkfile): if os.path.exists(apkfile):