From 7751bb56706357d73ddeaf5917cab26add23e301 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Fri, 6 Mar 2020 18:30:27 +0000 Subject: Properly extract version --- setup.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 8b9a070..6e32599 100644 --- a/setup.py +++ b/setup.py @@ -324,13 +324,18 @@ def check_requirements(): if __name__ == "__main__": check_requirements() - version = re.search( - '__version__ = "([^\']+)"', open("gensvm/__version__.py").read() - ).group(1) + here = os.path.abspath(os.path.dirname(__file__)) + about = {} + if not VERSION: + project_slug = NAME.lower().replace("-", "_").replace(" ", "_") + with open(os.path.join(here, project_slug, "__version__.py")) as fp: + exec(fp.read(), about) + else: + about["__version__"] = VERSION attr = configuration().todict() - attr["version"] = version + attr["version"] = about["__version__"] attr["description"] = DESCRIPTION attr["long_description"] = read("README.md") attr["long_description"] = "text/markdown" -- cgit v1.2.3