mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-05 18:50:09 +02:00
update: fix running without androguard
Soon, we can rip out all the aapt parsing stuff, but not yet!
This commit is contained in:
parent
5d39a97ab8
commit
17dc231dc9
@ -2528,7 +2528,7 @@ def get_first_signer_certificate(apkpath):
|
|||||||
elif len(cert_files) == 1:
|
elif len(cert_files) == 1:
|
||||||
cert_encoded = get_certificate(apk.read(cert_files[0]))
|
cert_encoded = get_certificate(apk.read(cert_files[0]))
|
||||||
|
|
||||||
if not cert_encoded:
|
if not cert_encoded and use_androguard():
|
||||||
apkobject = _get_androguard_APK(apkpath)
|
apkobject = _get_androguard_APK(apkpath)
|
||||||
certs = apkobject.get_certificates_der_v2()
|
certs = apkobject.get_certificates_der_v2()
|
||||||
if len(certs) > 0:
|
if len(certs) > 0:
|
||||||
|
@ -255,9 +255,13 @@ class UpdateTest(unittest.TestCase):
|
|||||||
self.assertEqual(good_fingerprint, sig,
|
self.assertEqual(good_fingerprint, sig,
|
||||||
'python sig was: ' + str(sig))
|
'python sig was: ' + str(sig))
|
||||||
# check that v1 and v2 have the same certificate
|
# check that v1 and v2 have the same certificate
|
||||||
import hashlib
|
try:
|
||||||
from binascii import hexlify
|
import hashlib
|
||||||
from androguard.core.bytecodes.apk import APK
|
from binascii import hexlify
|
||||||
|
from androguard.core.bytecodes.apk import APK
|
||||||
|
except ImportError:
|
||||||
|
print('WARNING: skipping rest of test since androguard is missing!')
|
||||||
|
return
|
||||||
apkobject = APK(apkpath)
|
apkobject = APK(apkpath)
|
||||||
cert_encoded = apkobject.get_certificates_der_v2()[0]
|
cert_encoded = apkobject.get_certificates_der_v2()[0]
|
||||||
self.assertEqual(good_fingerprint, sig,
|
self.assertEqual(good_fingerprint, sig,
|
||||||
|
Loading…
Reference in New Issue
Block a user