From 1d153260252c232adf2bf4a39362e6b1ac29e3e7 Mon Sep 17 00:00:00 2001 From: Christian Zangl Date: Fri, 28 Jun 2024 21:58:10 +0200 Subject: [PATCH] version info --- .github/workflows/build.yml | 10 +++++++--- chkbit_cli/__init__.py | 2 ++ chkbit_cli/main.py | 6 ++---- pyproject.toml | 3 ++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02dfd2a..99ea996 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,20 +34,24 @@ jobs: SITEPKG=$(pipenv run python -c "import site; print(site.getsitepackages()[-1])") pipenv run pyinstaller run.py --hidden-import chkbit --hidden-import chkbit_cli --onefile --name chkbit --console --paths $SITEPKG cat build/chkbit/warn-chkbit.txt + a=$(grep -oP '(?<=version = ")[^"]+' pyproject.toml) + b=$(grep -oP '(?<=__version__ = ")[^"]+' chkbit_cli/__init__.py) + if [[ $a != $b ]]; then echo "version error $a $b"; exit 1; fi cd dist; ls -l if [ "$RUNNER_OS" == "Linux" ]; then - ./chkbit --version + c=$(./chkbit --version) tar -czf chkbit-linux_amd64.tar.gz chkbit elif [ "$RUNNER_OS" == "macOS" ]; then - ./chkbit --version + c=$(./chkbit --version) tar -czf chkbit-macos_amd64.tar.gz chkbit elif [ "$RUNNER_OS" == "Windows" ]; then - chkbit.exe --version + c=$(chkbit.exe --version) 7z a -tzip chkbit-windows_amd64.zip chkbit.exe else echo 'unknown runner' exit 1 fi + if [[ $a != $c ]]; then echo "version error $a $c"; exit 1; fi - name: artifact uses: actions/upload-artifact@v4 diff --git a/chkbit_cli/__init__.py b/chkbit_cli/__init__.py index 4bc8024..a3ff3ef 100644 --- a/chkbit_cli/__init__.py +++ b/chkbit_cli/__init__.py @@ -2,3 +2,5 @@ from .cli import CLI from .progress import Progress from .sparklines import sparkify from .rate_calc import RateCalc + +__version__ = "4.2.1" diff --git a/chkbit_cli/main.py b/chkbit_cli/main.py index 21d0e59..1a11a7a 100644 --- a/chkbit_cli/main.py +++ b/chkbit_cli/main.py @@ -8,9 +8,7 @@ import threading import time from datetime import datetime, timedelta from chkbit import Context, Status, IndexThread -from . import CLI, Progress, RateCalc, sparkify - -import importlib.metadata +from . import CLI, Progress, RateCalc, sparkify, __version__ EPILOG = """ @@ -348,7 +346,7 @@ class Main: args = parser.parse_args() if args.version: - print(importlib.metadata.version("chkbit")) + print(__version__) return self.verbose = args.verbose or args.show_ignored_only diff --git a/pyproject.toml b/pyproject.toml index 8c02767..71351f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [project] name = "chkbit" -version = "4.2.0" +# because of packaging issues we keep this here and in chkbit_cli/__init__.py +version = "4.2.1" description = "chkbit checks the data integrity of your files" authors = [ {name = "Christian Zangl", email = "laktak@cdak.net"},