This makes writing test cases a lot easier. For example:
======================================================================
ERROR: test_devices (tests.test_install.InstallTest.test_devices)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/hans/code/fdroid/server/tests/test_install.py", line 31, in test_devices
devices = fdroidserver.install.devices()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hans/code/fdroid/server/fdroidserver/install.py", line 225, in devices
p = common.SdkToolsPopen(['adb', "devices"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hans/code/fdroid/server/fdroidserver/common.py", line 2921, in SdkToolsPopen
return FDroidPopen([abscmd] + commands[1:],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hans/code/fdroid/server/fdroidserver/common.py", line 3024, in FDroidPopen
result = FDroidPopenBytes(commands, cwd, envs, output, stderr_to_stdout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hans/code/fdroid/server/fdroidserver/common.py", line 2987, in FDroidPopenBytes
if output and options.verbose:
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'verbose'
There is no longer any reason for these to be intertwined.
This deliberately avoids touching some files as much as possible because
they are super tangled and due to be replaced. Those files are:
* fdroidserver/build.py
* fdroidserver/update.py
# Conflicts:
# tests/testcommon.py
# Conflicts:
# fdroidserver/btlog.py
# fdroidserver/import_subcommand.py
For some APKs, get_certificate() was returning a different result than
apksigner and keytool. So I just took the algorithm from androguard, which
uses asn1crypto instead of pyasn1. So that removes a dependency as well.
asn1crypto is already required by androguard.
The original get_certificate() came from 6e2d0a9e1
This also makes androguard a hard requirement, which has been true for a
while anyway. So the code that handles androguard as an optional
requirement is removed. androguard from Debian/buster is new enough, so
this does not seem like it will cause any problems.
This adds a check for "testOnly" to the existing "debuggable" check, since
they are very similar. We should really be refactoring all the checks into
a more reasonable setup. Since "debuggable" and "testOnly" are both set in
the same place (`<application>` in _AndroidManifest.xml_) and are both set
by the same process (running debug builds), I thought it would be OK to
include both in the same place. Plus it was a one-line change.
This will make all of the direct calls to logging level functions output
in a format that looks appropriate for the console. Previously, the default
output looked like it should be written to a log file.