summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorGabi Davar <grizzly.nyo@gmail.com>2015-04-26 18:11:26 +0300
committerMark Adams <mark@markadams.me>2015-05-17 22:44:53 -0500
commitc3e82547980d2f70440b1e198670f7ac1605418a (patch)
tree9be1ee0a43da711ddac327959172caa367024321 /setup.py
parentb4ede91a85be4befb4075da15a1ded8bf6874bbb (diff)
downloadpyjwt-c3e82547980d2f70440b1e198670f7ac1605418a.tar.gz
refactor scripts, testing, travis and tox
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py77
1 files changed, 36 insertions, 41 deletions
diff --git a/setup.py b/setup.py
index 5715ace..371219c 100755
--- a/setup.py
+++ b/setup.py
@@ -3,66 +3,46 @@
import os
import sys
-import jwt
-
-from setuptools import setup
-from setuptools.command.test import test
-
-
-class PyTest(test):
- user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
-
- def initialize_options(self):
- test.initialize_options(self)
- self.pytest_args = []
-
- def finalize_options(self):
- test.finalize_options(self)
- self.test_args = []
- self.test_suite = True
-
- def run_tests(self):
- # import here, cause outside the eggs aren't loaded
- import pytest
- errno = pytest.main(['.'] + self.pytest_args)
- sys.exit(errno)
+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
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
long_description = readme.read()
-
-def get_packages(package):
- """
- Return root package and all sub-packages.
- """
- return [
- dirpath
- for dirpath, dirnames, filenames in os.walk(package)
- if os.path.exists(os.path.join(dirpath, '__init__.py'))
- ]
-
-
if sys.argv[-1] == 'publish':
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(jwt.__version__))
+ print(" git tag -a {0} -m 'version {0}'".format(__version__))
print(' git push --tags')
sys.exit()
+tests_require = [
+ 'pytest',
+ 'pytest-cov',
+ 'pytest-runner',
+]
setup(
name='PyJWT',
- version=jwt.__version__,
+ version=__version__,
author='José Padilla',
author_email='hello@jpadilla.com',
description='JSON Web Token implementation in Python',
license='MIT',
keywords='jwt json web token security signing',
url='http://github.com/jpadilla/pyjwt',
- packages=get_packages('jwt'),
- scripts=['bin/jwt'],
+ packages=find_packages(
+ exclude=["*.tests", "*.tests.*", "tests.*", "tests"]
+ ),
long_description=long_description,
classifiers=[
'Development Status :: 5 - Production/Stable',
@@ -76,7 +56,22 @@ setup(
'Programming Language :: Python :: 3.4',
'Topic :: Utilities',
],
+ # install_requires=['cryptography'],
test_suite='tests',
- tests_require=['pytest', 'pytest-cov'],
- cmdclass={'test': PyTest},
+ setup_requires=['pytest-runner'],
+ tests_require=tests_require,
+ extras_require=dict(
+ test=tests_require,
+ crypto=['cryptography'],
+ flake8=[
+ 'flake8',
+ 'flake8-import-order',
+ 'pep8-naming'
+ ]
+ ),
+ entry_points={
+ 'console_scripts': [
+ 'jwt = jwt.__main__:main'
+ ]
+ }
)