Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a1e5c4a

Browse files
Merge pull request stripe#311 from stripe/brandur-requests-ceiling
Constrain Requests to < 2.13.0 if on setuptools < 18.0.0
2 parents 441c1f4 + dc94857 commit a1e5c4a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

setup.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@
77
except ImportError:
88
from distutils.core import setup
99

10+
# The Requests package added a release in 2.14.0 that broke a whole bunch of
11+
# people on old versions of pip and setuptools (< 18.0.0). Here we check to see
12+
# whether we have a version that might be affected so that we can add a maximum
13+
# version for Requests.
14+
#
15+
# This can probably removed after most people have moved to setuptools 18.0.0+.
16+
#
17+
# More context here: https://github.com/stripe/stripe-python/pull/311
18+
old_setuptools_version = False
19+
try:
20+
from distutils.version import StrictVersion
21+
import setuptools
22+
if StrictVersion(setuptools.__version__) < StrictVersion("18.0.0"):
23+
old_setuptools_version = True
24+
except ImportError:
25+
pass
26+
1027
try:
1128
from distutils.command.build_py import build_py_2to3 as build_py
1229
except ImportError:
@@ -25,6 +42,8 @@
2542
DeprecationWarning)
2643
install_requires.append('requests >= 0.8.8, < 0.10.1')
2744
install_requires.append('ssl')
45+
elif old_setuptools_version:
46+
install_requires.append('requests >= 0.8.8, < 2.14.0')
2847
else:
2948
install_requires.append('requests >= 0.8.8')
3049

0 commit comments

Comments
 (0)