Skip to content

Commit 06c800c

Browse files
authored
feat: retrieve downloader version via cli (#83)
This allows early detection of missing "pip install -e ."
1 parent 3a332a0 commit 06c800c

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

varfish_db_downloader/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
import requests_ftp
99
from loguru import logger
1010

11-
from varfish_db_downloader import wget
11+
from varfish_db_downloader import __version__, wget
1212

1313

1414
@click.group()
15+
@click.version_option(__version__)
1516
def main():
1617
"""Main entry point for the CLI interface"""
1718
logger.remove()

varfish_db_downloader/versions.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,22 +192,17 @@ class PackageVersions:
192192
def get_version(executable: str) -> str:
193193
"""Return version of ``executable``."""
194194
tmp: str = subprocess.check_output([executable, "--version"], text=True)
195-
_, version = tmp.strip().split(" ", 1)
196-
return version
197-
198-
199-
def downloader_version() -> str:
200-
"""Return the downloader version."""
201-
if RUNS_IN_CI:
202-
return "0.0.0"
195+
if executable == "varfish-db-downloader":
196+
_, _, version = tmp.strip().split(" ", 2)
203197
else:
204-
subprocess.check_output(["git", "describe", "--tags"], text=True).strip()[1:]
198+
_, version = tmp.strip().split(" ", 1)
199+
return version
205200

206201

207202
#: The package versions from environment.
208203
PACKAGE_VERSIONS = PackageVersions(
209-
downloader=downloader_version(),
210204
annonars=get_version("annonars"),
211205
viguno=get_version("viguno"),
212206
worker=get_version("varfish-server-worker"),
207+
downloader=get_version("varfish-db-downloader"),
213208
)

0 commit comments

Comments
 (0)