Skip to content

Commit

Permalink
Fix version calc when running directly
Browse files Browse the repository at this point in the history
  • Loading branch information
grillo-delmal committed Mar 18, 2024
1 parent 3e9358f commit 85f5c7c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pytankbattle/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ def get_version():
with open(os.path.join(datadir, 'VERSION')) as version_file:
version = version_file.read().strip()
else:
from importlib import metadata
# The application is not frozen
# Change this bit to match where you store your data files:
version = metadata.version("pytankbattle")
from importlib import metadata
# TODO: Correctly detect if installed or running from source
try:
version = metadata.version("pytankbattle")
except metadata.PackageNotFoundError:
from setuptools_git_versioning import get_version
version = str(get_version(root=".."))

return version

0 comments on commit 85f5c7c

Please sign in to comment.