Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit d2bc406

Browse files
committed
Use markers for conditional dependencies.
1 parent da1e8b6 commit d2bc406

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

setup.py

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,6 @@ def run_tests(self):
4343
os.system('python setup.py sdist upload')
4444
sys.exit()
4545

46-
py_version = sys.version_info[:2]
47-
py_long_version = sys.version_info[:3]
48-
49-
try:
50-
pypy_version = sys.pypy_version_info[:2]
51-
except AttributeError:
52-
pypy_version = None
53-
54-
55-
def resolve_install_requires():
56-
basic_dependencies = ['h2>=2.3,<3.0', 'hyperframe>=3.2,<4.0']
57-
58-
if py_version == (3, 3):
59-
basic_dependencies.extend(
60-
['pyOpenSSL>=0.15', 'service_identity>=14.0.0']
61-
)
62-
elif py_version == (2, 7) and py_long_version < (2, 7, 9):
63-
basic_dependencies.extend(
64-
['pyOpenSSL>=0.15', 'service_identity>=14.0.0']
65-
)
66-
67-
# PyPy earlier than 2.6.0 doesn't support cryptography 1.0
68-
if pypy_version and pypy_version < (2, 6):
69-
basic_dependencies.append('cryptography<1.0')
70-
71-
return basic_dependencies
7246

7347
packages = [
7448
'hyper',
@@ -104,7 +78,7 @@ def resolve_install_requires():
10478
'Programming Language :: Python :: 3.5',
10579
'Programming Language :: Python :: Implementation :: CPython',
10680
],
107-
install_requires=resolve_install_requires(),
81+
install_requires=['h2>=2.3,<3.0', 'hyperframe>=3.2,<4.0'],
10882
tests_require=['pytest', 'requests', 'mock'],
10983
cmdclass={'test': PyTest},
11084
entry_points={
@@ -114,5 +88,14 @@ def resolve_install_requires():
11488
},
11589
extras_require={
11690
'fast': ['pycohttpparser'],
91+
# Fallback to good SSL on bad Python versions.
92+
':python_full_version < "2.7.9" or python_version == "3.3"': [
93+
'pyOpenSSL>=0.15', 'service_identity>=14.0.0'
94+
],
95+
# PyPy with bad SSL modules will likely also need the cryptography
96+
# module at lower than 1.0, because it doesn't support CFFI v1.0 yet.
97+
':platform_python_implementation == "PyPy" and python_full_version < "2.7.9"': [
98+
'cryptography<1.0'
99+
]
117100
}
118101
)

0 commit comments

Comments
 (0)