Skip to content

Commit 28e4dc6

Browse files
committed
feat: add git tag version in wheel build
1 parent ff9c29f commit 28e4dc6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

setup.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
from setuptools import setup, find_packages
2+
import sys
3+
4+
5+
def get_version() -> str:
6+
version = {}
7+
path_to_file_with_version = "time_tracker_api/__init__.py"
8+
try:
9+
with open(path_to_file_with_version) as fp:
10+
exec(fp.read(), version)
11+
__version__ = version['__version__']
12+
return __version__
13+
except KeyError:
14+
print(f'Error: No variable ___version___ in {path_to_file_with_version}')
15+
sys.exit()
16+
217

318
setup(
419
name="time-tracker-backend",
20+
version=get_version(),
521
packages=find_packages(),
622
include_package_data=True,
723
)

0 commit comments

Comments
 (0)