Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 57810bb

Browse files
committedAug 30, 2021
set version in setup.py
1 parent 6d2e953 commit 57810bb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
 

‎setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,20 @@ def list2cmdline(cmd_list):
6666
}
6767

6868

69+
# -----------------------------------------------------------------------------
70+
# Library Version
71+
# -----------------------------------------------------------------------------
72+
73+
pkg_root_init_file = package_dir / "__init__.py"
74+
for line in pkg_root_init_file.read_text().split("\n"):
75+
if line.startswith("__version__ = "):
76+
package["version"] = eval(line.split("=", 1)[1])
77+
break
78+
else:
79+
print(f"No version found in {pkg_root_init_file}")
80+
sys.exit(1)
81+
82+
6983
# -----------------------------------------------------------------------------
7084
# Requirements
7185
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)
Please sign in to comment.