Skip to content

Commit

Permalink
Switched to using new get_version() in setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-adams committed May 18, 2015
1 parent bf03705 commit af9e4ba
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys

from setuptools import find_packages, setup

__version__ = None
with open('jwt/__init__.py') as fp:
_locals = {}
for line in fp:
if line.startswith('__version__'):
exec(line, None, _locals)
__version__ = _locals['__version__']
break

def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
with open(os.path.join(package, '__init__.py'), 'rb') as init_py:
src = init_py.read().decode('utf-8')
return re.search("__version__ = ['\"]([^'\"]+)['\"]", src).group(1)


version = get_version('jwt')

with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
long_description = readme.read()
Expand All @@ -21,7 +25,7 @@
os.system('python setup.py sdist upload')
os.system('python setup.py bdist_wheel upload')
print('You probably want to also tag the version now:')
print(" git tag -a {0} -m 'version {0}'".format(__version__))
print(" git tag -a {0} -m 'version {0}'".format(version))
print(' git push --tags')
sys.exit()

Expand All @@ -33,7 +37,7 @@

setup(
name='PyJWT',
version=__version__,
version=version,
author='José Padilla',
author_email='[email protected]',
description='JSON Web Token implementation in Python',
Expand Down

0 comments on commit af9e4ba

Please sign in to comment.