Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

Commit

Permalink
FIX: enable reading wkz version for already installed packages (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
fgebhart authored Jul 5, 2021
1 parent a2ea990 commit 53dd96a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 2 additions & 20 deletions workoutizer/__init__.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 53dd96a

Please sign in to comment.