skip new signing test when we can't find apksigner

Also add some error handling to the find_apksigner() method.
This commit is contained in:
Marcus Hoffmann 2020-09-10 17:26:50 +02:00
parent f6b7572b10
commit 7eb32feaa5
2 changed files with 6 additions and 0 deletions

View File

@ -429,7 +429,11 @@ def find_apksigner():
if set_command_in_config('apksigner'):
return config['apksigner']
build_tools_path = os.path.join(config['sdk_path'], 'build-tools')
if not os.path.isdir(build_tools_path):
return None
for f in sorted(os.listdir(build_tools_path), reverse=True):
if not os.path.isdir(os.path.join(build_tools_path, f)):
continue
if LooseVersion(f) < LooseVersion(MINIMUM_AAPT_BUILD_TOOLS_VERSION):
return None
if os.path.exists(os.path.join(build_tools_path, f, 'apksigner')):

View File

@ -675,6 +675,8 @@ class CommonTest(unittest.TestCase):
def test_sign_apk_targetsdk_30(self):
fdroidserver.common.config = None
config = fdroidserver.common.read_config(fdroidserver.common.options)
if not fdroidserver.common.find_apksigner():
self.skipTest('SKIPPING as apksigner is not installed!')
config['jarsigner'] = fdroidserver.common.find_sdk_tools_cmd('jarsigner')
config['keyalias'] = 'sova'
config['keystorepass'] = 'r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI='