aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2017-07-13 14:59:22 -0400
committerJason R. Coombs <jaraco@jaraco.com>2017-07-13 14:59:22 -0400
commit387d0e532272855d19aaed536ad0d3096eebfb87 (patch)
treedb8cd08c2832f69350c3bea4640297ebd9ee65a6
parentdd622e26da86651bf1f0506452c2c55eb1eb8f4d (diff)
downloadexternal_python_setuptools-387d0e532272855d19aaed536ad0d3096eebfb87.tar.gz
external_python_setuptools-387d0e532272855d19aaed536ad0d3096eebfb87.tar.bz2
external_python_setuptools-387d0e532272855d19aaed536ad0d3096eebfb87.zip
Restrict use of os.makedirs to those with the security patch introduced in Python 3.2.6, 3.3.5, and 3.4.1 per https://bugs.python.org/issue21082. Ref #1082.
-rw-r--r--pkg_resources/py31compat.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/pkg_resources/py31compat.py b/pkg_resources/py31compat.py
index c6217af7..f8875aaa 100644
--- a/pkg_resources/py31compat.py
+++ b/pkg_resources/py31compat.py
@@ -3,9 +3,6 @@ import errno
import sys
-PY32 = sys.version_info >= (3, 2)
-
-
def _makedirs_31(path, exist_ok=False):
try:
os.makedirs(path)
@@ -14,4 +11,12 @@ def _makedirs_31(path, exist_ok=False):
raise
-makedirs = os.makedirs if PY32 else _makedirs_31
+# rely on compatibility behavior until mode considerations
+# and exists_ok considerations are disentangled.
+# See https://github.com/pypa/setuptools/pull/1083#issuecomment-315168663
+needs_makedirs = (
+ sys.version_info <= (3, 2, 6) or
+ (3, 3) <= sys.version_info <= (3, 3, 5) or
+ (3, 4) <= sys.version_info <= (3, 4, 1)
+)
+makedirs = os.makedirs if needs_makedirs else _makedirs_31