This repository has been archived by the owner on Jan 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: enable reading wkz version for already installed packages (#180)
- Loading branch information
Showing
2 changed files
with
3 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |