Skip to content

Commit 8931893

Browse files
author
Gasper Zejn
committed
Implement optional backends for python-jose as setup.py extras. This allows
installing running pip install python-jose[cryptography] to install with cryptography. Supported backends libraries are cryptography, pycrypto and cryptodome.
1 parent 7403dff commit 8931893

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

setup.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import jose
66

7-
import platform
8-
97
from setuptools import setup
108

119

@@ -24,17 +22,11 @@ def get_packages(package):
2422
]
2523

2624

27-
def get_install_requires():
28-
if platform.python_implementation() == 'PyPy':
29-
crypto_lib = 'pycryptodome >=3.3.1, <3.4.0'
30-
else:
31-
crypto_lib = 'pycrypto >=2.6.0, <2.7.0'
32-
return [
33-
crypto_lib,
34-
'six <2.0',
35-
'ecdsa <1.0',
36-
'future <1.0',
37-
]
25+
extras_require = {
26+
'cryptography': ['cryptography'],
27+
'pycrypto': ['pycrypto >=2.6.0, <2.7.0'],
28+
'pycryptodome': ['pycryptodome >=3.3.1, <3.4.0'],
29+
}
3830

3931

4032
setup(
@@ -63,5 +55,6 @@ def get_install_requires():
6355
'Programming Language :: Python :: Implementation :: PyPy',
6456
'Topic :: Utilities',
6557
],
66-
install_requires=get_install_requires()
58+
extras_require=extras_require,
59+
install_requires=['six <2.0', 'ecdsa <1.0', 'future <1.0']
6760
)

0 commit comments

Comments
 (0)