Skip to content

Commit

Permalink
feat: retrieve downloader version via cli (#83)
Browse files Browse the repository at this point in the history
This allows early detection of missing "pip install -e ."
  • Loading branch information
holtgrewe authored Jan 8, 2024
1 parent 3a332a0 commit 06c800c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
3 changes: 2 additions & 1 deletion varfish_db_downloader/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
import requests_ftp
from loguru import logger

from varfish_db_downloader import wget
from varfish_db_downloader import __version__, wget


@click.group()
@click.version_option(__version__)
def main():
"""Main entry point for the CLI interface"""
logger.remove()
Expand Down
15 changes: 5 additions & 10 deletions varfish_db_downloader/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,17 @@ class PackageVersions:
def get_version(executable: str) -> str:
"""Return version of ``executable``."""
tmp: str = subprocess.check_output([executable, "--version"], text=True)
_, version = tmp.strip().split(" ", 1)
return version


def downloader_version() -> str:
"""Return the downloader version."""
if RUNS_IN_CI:
return "0.0.0"
if executable == "varfish-db-downloader":
_, _, version = tmp.strip().split(" ", 2)
else:
subprocess.check_output(["git", "describe", "--tags"], text=True).strip()[1:]
_, version = tmp.strip().split(" ", 1)
return version


#: The package versions from environment.
PACKAGE_VERSIONS = PackageVersions(
downloader=downloader_version(),
annonars=get_version("annonars"),
viguno=get_version("viguno"),
worker=get_version("varfish-server-worker"),
downloader=get_version("varfish-db-downloader"),
)

0 comments on commit 06c800c

Please sign in to comment.