aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/py27compat.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-12-21 14:15:37 -0500
committerJason R. Coombs <jaraco@jaraco.com>2016-12-21 14:39:59 -0500
commit5ad13718686bee04a93b4e86929c1bb170f14a52 (patch)
tree06dbea4dd959755a65ba2c9941d5942b98c3b91a /setuptools/py27compat.py
parenta17fa50d2675d89077be09d668a073c751b76e0c (diff)
downloadexternal_python_setuptools-5ad13718686bee04a93b4e86929c1bb170f14a52.tar.gz
external_python_setuptools-5ad13718686bee04a93b4e86929c1bb170f14a52.tar.bz2
external_python_setuptools-5ad13718686bee04a93b4e86929c1bb170f14a52.zip
Cast the value to rmtree to bytes on Linux and Python 2 when the filesystemencoding is ascii, and let posixpath work its voodoo. Fixes #706.
Diffstat (limited to 'setuptools/py27compat.py')
-rw-r--r--setuptools/py27compat.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/setuptools/py27compat.py b/setuptools/py27compat.py
index 4e3e4ab3..a71a936e 100644
--- a/setuptools/py27compat.py
+++ b/setuptools/py27compat.py
@@ -3,6 +3,7 @@ Compatibility Support for Python 2.7 and earlier
"""
import sys
+import platform
def get_all_headers(message, key):
@@ -16,3 +17,13 @@ if sys.version_info < (3,):
def get_all_headers(message, key):
return message.getheaders(key)
+
+
+linux_py2_ascii = (
+ platform.system() == 'Linux' and
+ sys.getfilesystemencoding() == 'ascii' and
+ sys.version_info < (3,)
+)
+
+rmtree_safe = str if linux_py2_ascii else lambda x: x
+"""Workaround for http://bugs.python.org/issue24672"""