add complete tests for finding apksigner; fix minor detection bug

find_apksigner() was preferring the oldest valid version rather than the
newest.
This commit is contained in:
Hans-Christoph Steiner 2021-03-18 09:47:19 +01:00
parent 9135dfbeed
commit b69b95103e
2 changed files with 98 additions and 12 deletions

View file

@ -285,7 +285,7 @@ def regsub_file(pattern, repl, path):
f.write(text)
def read_config(opts):
def read_config(opts=None):
"""Read the repository config
The config is read from config_file, which is in the current
@ -489,14 +489,15 @@ def find_apksigner(config):
continue
try:
if LooseVersion(f) < LooseVersion(MINIMUM_APKSIGNER_BUILD_TOOLS_VERSION):
logging.debug("Local Android SDK only has outdated apksigner versions")
return
except TypeError:
continue
if os.path.exists(os.path.join(build_tools_path, f, 'apksigner')):
apksigner = os.path.join(build_tools_path, f, 'apksigner')
logging.info("Using %s " % apksigner)
# memoize result
config['apksigner'] = apksigner
return
def find_sdk_tools_cmd(cmd):