diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-21 14:15:37 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-21 14:39:59 -0500 |
commit | 5ad13718686bee04a93b4e86929c1bb170f14a52 (patch) | |
tree | 06dbea4dd959755a65ba2c9941d5942b98c3b91a | |
parent | a17fa50d2675d89077be09d668a073c751b76e0c (diff) | |
download | external_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.
-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 |