forked from jpadilla/pyjwt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched to using new get_version() in setup.py
- Loading branch information
1 parent
bf03705
commit af9e4ba
Showing
1 changed file
with
14 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
|
@@ -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() | ||
|
||
|
@@ -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', | ||
|