diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-09-28 18:55:04 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-09-28 18:55:04 +0200 |
commit | ccbf216aaf6e10d60e3138cbbed93359acfe71a2 (patch) | |
tree | f2236b58b9f09339ea956d633b04a005b8c511d4 | |
parent | f2ed0d5d7b3fbd45d68692185781d0d7e7742159 (diff) | |
download | fietsboek-ccbf216aaf6e10d60e3138cbbed93359acfe71a2.tar.gz fietsboek-ccbf216aaf6e10d60e3138cbbed93359acfe71a2.tar.bz2 fietsboek-ccbf216aaf6e10d60e3138cbbed93359acfe71a2.zip |
reorganize updater CLI
This moves the updater scripts into a subfolder, which keeps them
separated better from the rest of the package. In addition, we now have
the "fietsupdate" command instead of using "python -m
fietsboek.updater".
-rw-r--r-- | fietsboek/updater/__init__.py | 4 | ||||
-rw-r--r-- | fietsboek/updater/cli.py (renamed from fietsboek/updater/__main__.py) | 0 | ||||
-rw-r--r-- | setup.py | 1 |
3 files changed, 3 insertions, 2 deletions
diff --git a/fietsboek/updater/__init__.py b/fietsboek/updater/__init__.py index 038fcd5..724defa 100644 --- a/fietsboek/updater/__init__.py +++ b/fietsboek/updater/__init__.py @@ -244,7 +244,7 @@ class Updater: ) filename = f"upd_{revision_id}.py" - filepath = Path(__file__).parent / filename + filepath = Path(__file__).parent / "scripts" / filename LOGGER.info("Writing new revision (%s) to %r", revision_id, filepath) with open(filepath, "x", encoding="utf-8") as fobj: fobj.write(revision) @@ -346,7 +346,7 @@ def _filename_to_modname(name): def _load_update_scripts(): """Loads all available import scripts.""" - files = importlib_resources.files(__name__) + files = importlib_resources.files(__name__) / "scripts" return [ UpdateScript(file.read_text(), _filename_to_modname(file.name)) for file in files.iterdir() diff --git a/fietsboek/updater/__main__.py b/fietsboek/updater/cli.py index 38297d7..38297d7 100644 --- a/fietsboek/updater/__main__.py +++ b/fietsboek/updater/cli.py @@ -63,6 +63,7 @@ setup( ], 'console_scripts': [ 'fietsctl=fietsboek.scripts.fietsctl:main', + 'fietsupdate=fietsboek.updater.cli:cli', ], }, ) |