From ade398f263c9d90504ca602c7fbe3bf83ec971f0 Mon Sep 17 00:00:00 2001 From: Hugo Bessa Date: Mon, 14 Aug 2023 19:32:30 -0300 Subject: [PATCH] Update setup.py to better handle version --- setup.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 5553563..eb92733 100755 --- a/setup.py +++ b/setup.py @@ -21,11 +21,19 @@ def read(*parts): with codecs.open(filename, encoding='utf-8') as fp: return fp.read() -version_tuple = __import__('django_js_reverse').VERSION -version = '.'.join([str(v) for v in version_tuple]) + +def get_version(rel_path): + for line in read(rel_path).splitlines(): + if line.startswith('__version__'): + delim = '"' if '"' in line else "'" + return line.split(delim)[1] + else: + raise RuntimeError("Unable to find version string.") + + setup( name='django-js-reverse', - version=version, + version=get_version("django_js_reverse/__init__.py"), classifiers=[ 'Programming Language :: Python', 'Programming Language :: Python :: 3',