mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
install: download_fdroid_apk() to fetch the recommended initial APK
This commit is contained in:
parent
56bed02a29
commit
49dcc53076
2 changed files with 19 additions and 0 deletions
|
|
@ -72,6 +72,18 @@ def download_apk(appid='org.fdroid.fdroid'):
|
||||||
return str(f.rename(f.with_stem(f'{appid}_{versionCode}')).resolve())
|
return str(f.rename(f.with_stem(f'{appid}_{versionCode}')).resolve())
|
||||||
|
|
||||||
|
|
||||||
|
def download_fdroid_apk():
|
||||||
|
"""Directly download the current F-Droid APK and verify it.
|
||||||
|
|
||||||
|
This downloads the "download button" link, which is the version
|
||||||
|
that is best tested for new installs.
|
||||||
|
|
||||||
|
"""
|
||||||
|
mirror = common.FDROIDORG_MIRRORS[0]
|
||||||
|
mirror['url'] = urlunparse(urlparse(mirror['url'])._replace(path='F-Droid.apk'))
|
||||||
|
return net.download_using_mirrors([mirror])
|
||||||
|
|
||||||
|
|
||||||
def devices():
|
def devices():
|
||||||
p = SdkToolsPopen(['adb', "devices"])
|
p = SdkToolsPopen(['adb', "devices"])
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
localmodule = os.path.realpath(
|
localmodule = os.path.realpath(
|
||||||
os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..')
|
os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..')
|
||||||
)
|
)
|
||||||
|
|
@ -33,6 +35,11 @@ class InstallTest(unittest.TestCase):
|
||||||
for device in devices:
|
for device in devices:
|
||||||
self.assertIsInstance(device, str)
|
self.assertIsInstance(device, str)
|
||||||
|
|
||||||
|
@unittest.skipUnless(os.getenv('test_download_fdroid_apk'), 'requires net access')
|
||||||
|
def test_download_fdroid_apk(self):
|
||||||
|
f = fdroidserver.install.download_fdroid_apk()
|
||||||
|
self.assertTrue(Path(f).exists())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
os.chdir(os.path.dirname(__file__))
|
os.chdir(os.path.dirname(__file__))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue