diff options
-rwxr-xr-x | setuptools/command/easy_install.py | 3 | ||||
-rw-r--r-- | setuptools/py27compat.py | 11 | ||||
-rw-r--r-- | setuptools/tests/test_easy_install.py | 2 |
3 files changed, 13 insertions, 3 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 14ad25c2..36e7f359 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -46,6 +46,7 @@ from setuptools.extern.six.moves import configparser, map from setuptools import Command from setuptools.sandbox import run_setup from setuptools.py31compat import get_path, get_config_vars +from setuptools.py27compat import rmtree_safe from setuptools.command import setopt from setuptools.archive_util import unpack_archive from setuptools.package_index import ( @@ -634,7 +635,7 @@ class easy_install(Command): # cast to str as workaround for #709 and #710 and #712 yield str(tmpdir) finally: - os.path.exists(tmpdir) and rmtree(tmpdir) + os.path.exists(tmpdir) and rmtree(rmtree_safe(tmpdir)) def easy_install(self, spec, deps=False): if not self.editable: 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""" diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 08138efc..1ea33b08 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -169,8 +169,6 @@ class TestEasyInstallTest: sdist_zip.close() return str(sdist) - @pytest.mark.xfail(setuptools.tests.is_ascii, - reason="https://github.com/pypa/setuptools/issues/706") def test_unicode_filename_in_sdist(self, sdist_unicode, tmpdir, monkeypatch): """ The install command should execute correctly even if |