Skip to content

Commit

Permalink
Merge pull request #320 from moltenform/master
Browse files Browse the repository at this point in the history
fix: More straightforward way to retrieve the current version number
  • Loading branch information
skorokithakis authored Jun 10, 2024
2 parents e2d0fd4 + c33b817 commit 25891a0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import codecs
import os
import sys
import re

from setuptools import setup

Expand All @@ -9,7 +10,9 @@
with open(version_file) as f:
for line in f.read().split("\n"):
if line.startswith("__version__ ="):
version = eval(line.split("=", 1)[1])
version = re.match(
r"^\s*__version__\s*=\s*['\"](.*?)['\"]\s*$", line
).group(1)
break
else:
print("No __version__ attribute found in %r" % version_file)
Expand Down

0 comments on commit 25891a0

Please sign in to comment.