diff --git a/CHANGELOG.md b/CHANGELOG.md index a72a7095..f7d7d18d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * When looking for activities on device allow files next to device dir. ### Fixed * Test for mounting devices fails sometimes, because it was not ready for block device mounting. +* Fix reading package version of already installed workoutizer package. ## [0.20.1](https://github.com/fgebhart/workoutizer/releases/tag/v0.20.1) - 2021-06-25 ### Changed diff --git a/workoutizer/__init__.py b/workoutizer/__init__.py index 69b8143c..38b3e4da 100644 --- a/workoutizer/__init__.py +++ b/workoutizer/__init__.py @@ -1,21 +1,3 @@ -import os -import subprocess -from pathlib import Path +import pkg_resources - -def _get_version() -> str: - cwd = Path.cwd() - os.chdir(Path(__file__).parent.parent) - try: - cmd = ["python", "-W", "ignore", "setup.py", "-V"] - out = subprocess.check_output(cmd, stderr=subprocess.DEVNULL) - if not isinstance(out, str): - out = out.decode("utf-8") - version = out.strip() - except Exception: - version = "unknown" - os.chdir(cwd) - return version - - -__version__ = _get_version() +__version__ = pkg_resources.require("workoutizer")[0].version