[import] Rename to import_subcommand internally

This enables normal import of the module without the need for
workarounds.
This commit is contained in:
FestplattenSchnitzel 2022-08-05 19:34:28 +02:00 committed by Hans-Christoph Steiner
parent 2eb56ae8d4
commit 7b7f863c65
6 changed files with 11 additions and 41 deletions

View file

@ -40,7 +40,7 @@ COMMANDS = OrderedDict([
("deploy", _("Interact with the repo HTTP server")),
("verify", _("Verify the integrity of downloaded packages")),
("checkupdates", _("Check for updates to applications")),
("import", _("Add a new application from its source code")),
("import", _("Extract application metadata from a source repository")),
("install", _("Install built packages on devices")),
("readmeta", _("Read all the metadata files and exit")),
("rewritemeta", _("Rewrite all the metadata files")),
@ -197,6 +197,8 @@ def main():
del sys.argv[1]
if command in COMMANDS.keys():
# import is named import_subcommand internally b/c import is reserved by Python
command = 'import_subcommand' if command == 'import' else command
mod = __import__('fdroidserver.' + command, None, None, [command])
else:
mod = __import__(available_plugins[command]['name'], None, None, [command])

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# import.py - part of the FDroid server tools
# import_subcommand.py - part of the FDroid server tools
# Copyright (C) 2010-13, Ciaran Gultnieks, ciaran@ciarang.com
# Copyright (C) 2013-2014 Daniel Martí <mvdan@mvdan.cc>
#
@ -42,9 +42,6 @@ config = None
options = None
# WARNING! This cannot be imported as a Python module, so reuseable functions need to go into common.py!
def clone_to_tmp_dir(app):
tmp_dir = Path('tmp')
tmp_dir.mkdir(exist_ok=True)