1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 11:00:10 +01:00
fdroidserver/fdroidserver/__init__.py
Hans-Christoph Steiner 810387a009 deploy: update_serverwebroots() for testable logic
This moves all of the serverwebroot: logic into a function, and adds tests.
I did this because I ran into issues in the logic in main():

Traceback (most recent call last):
  File "/builds/eighthave/fdroidserver/fdroid", line 22, in <module>
    fdroidserver.__main__.main()
  File "/builds/eighthave/fdroidserver/fdroidserver/__main__.py", line 230, in main
    raise e
  File "/builds/eighthave/fdroidserver/fdroidserver/__main__.py", line 211, in main
    mod.main()
  File "/builds/eighthave/fdroidserver/fdroidserver/deploy.py", line 753, in main
    s = serverwebroot.rstrip('/').split(':')
AttributeError: 'dict' object has no attribute 'rstrip'
2024-01-23 18:49:12 +01:00

64 lines
2.2 KiB
Python

import gettext
import glob
import os
import sys
# support running straight from git and standard installs
rootpaths = [
os.path.realpath(os.path.join(os.path.dirname(__file__), '..')),
os.path.realpath(
os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'share')
),
os.path.join(sys.prefix, 'share'),
]
localedir = None
for rootpath in rootpaths:
if len(glob.glob(os.path.join(rootpath, 'locale', '*', 'LC_MESSAGES', 'fdroidserver.mo'))) > 0:
localedir = os.path.join(rootpath, 'locale')
break
gettext.bindtextdomain('fdroidserver', localedir)
gettext.textdomain('fdroidserver')
_ = gettext.gettext
from fdroidserver.exception import (FDroidException,
MetaDataException,
VerificationException) # NOQA: E402
FDroidException # NOQA: B101
MetaDataException # NOQA: B101
VerificationException # NOQA: B101
from fdroidserver.common import (verify_apk_signature,
genkeystore as generate_keystore) # NOQA: E402
verify_apk_signature # NOQA: B101
generate_keystore # NOQA: B101
from fdroidserver.index import (download_repo_index,
download_repo_index_v1,
download_repo_index_v2,
get_mirror_service_urls,
make as make_index) # NOQA: E402
download_repo_index # NOQA: B101
download_repo_index_v1 # NOQA: B101
download_repo_index_v2 # NOQA: B101
get_mirror_service_urls # NOQA: B101
make_index # NOQA: B101
from fdroidserver.update import (process_apk,
process_apks,
scan_apk,
scan_repo_files) # NOQA: E402
process_apk # NOQA: B101
process_apks # NOQA: B101
scan_apk # NOQA: B101
scan_repo_files # NOQA: B101
from fdroidserver.deploy import (update_awsbucket,
update_servergitmirrors,
update_serverwebroots,
update_serverwebroot) # NOQA: E402
update_awsbucket # NOQA: B101
update_servergitmirrors # NOQA: B101
update_serverwebroots # NOQA: B101
update_serverwebroot # NOQA: B101