|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 |
|
3 | | -import os |
4 | | -import re |
5 | | -import sys |
| 3 | +from setuptools import setup |
6 | 4 |
|
7 | | -from setuptools import find_packages, setup |
8 | | - |
9 | | - |
10 | | -def get_version(package): |
11 | | - """ |
12 | | - Return package version as listed in `__version__` in `init.py`. |
13 | | - """ |
14 | | - with open(os.path.join(package, "__init__.py"), "rb") as init_py: |
15 | | - src = init_py.read().decode("utf-8") |
16 | | - return re.search("__version__ = ['\"]([^'\"]+)['\"]", src).group(1) |
17 | | - |
18 | | - |
19 | | -version = get_version("jwt") |
20 | | - |
21 | | -with open(os.path.join(os.path.dirname(__file__), "README.rst")) as readme: |
22 | | - long_description = readme.read() |
23 | | - |
24 | | -if sys.argv[-1] == "publish": |
25 | | - if os.system("pip freeze | grep twine"): |
26 | | - print("twine not installed.\nUse `pip install twine`.\nExiting.") |
27 | | - sys.exit() |
28 | | - os.system("python setup.py sdist bdist_wheel") |
29 | | - os.system("twine upload dist/*") |
30 | | - print("You probably want to also tag the version now:") |
31 | | - print(" git tag -a {0} -m 'version {0}'".format(version)) |
32 | | - print(" git push --tags") |
33 | | - sys.exit() |
34 | | - |
35 | | -EXTRAS_REQUIRE = { |
36 | | - "tests": ["pytest>=4.0.1,<5.0.0", "pytest-cov>=2.6.0,<3.0.0"], |
37 | | - "crypto": ["cryptography >= 1.4"], |
38 | | -} |
39 | | - |
40 | | -EXTRAS_REQUIRE["dev"] = ( |
41 | | - EXTRAS_REQUIRE["tests"] + EXTRAS_REQUIRE["crypto"] + ["mypy", "pre-commit"] |
42 | | -) |
43 | | - |
44 | | -setup( |
45 | | - name="PyJWT", |
46 | | - version=version, |
47 | | - author="Jose Padilla", |
48 | | - |
49 | | - description="JSON Web Token implementation in Python", |
50 | | - license="MIT", |
51 | | - keywords="jwt json web token security signing", |
52 | | - url="https://github.com/jpadilla/pyjwt", |
53 | | - packages=find_packages( |
54 | | - exclude=["*.tests", "*.tests.*", "tests.*", "tests"] |
55 | | - ), |
56 | | - long_description=long_description, |
57 | | - classifiers=[ |
58 | | - "Development Status :: 5 - Production/Stable", |
59 | | - "Intended Audience :: Developers", |
60 | | - "Natural Language :: English", |
61 | | - "License :: OSI Approved :: MIT License", |
62 | | - "Programming Language :: Python", |
63 | | - "Programming Language :: Python :: 3", |
64 | | - "Programming Language :: Python :: 3 :: Only", |
65 | | - "Programming Language :: Python :: 3.5", |
66 | | - "Programming Language :: Python :: 3.6", |
67 | | - "Programming Language :: Python :: 3.7", |
68 | | - "Programming Language :: Python :: 3.8", |
69 | | - "Topic :: Utilities", |
70 | | - ], |
71 | | - python_requires=">=3.5", |
72 | | - extras_require=EXTRAS_REQUIRE, |
73 | | - entry_points={"console_scripts": ["pyjwt = jwt.__main__:main"]}, |
74 | | -) |
| 5 | +setup() |
0 commit comments