Skip to content

Commit

Permalink
Update setup.py to better handle version
Browse files Browse the repository at this point in the history
  • Loading branch information
hugobessa authored Aug 14, 2023
1 parent 0190953 commit ade398f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit ade398f

Please sign in to comment.