Commit 5ad13718 authored by Jason R. Coombs's avatar Jason R. Coombs

Cast the value to rmtree to bytes on Linux and Python 2 when the...

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.
parent a17fa50d
...@@ -46,6 +46,7 @@ from setuptools.extern.six.moves import configparser, map ...@@ -46,6 +46,7 @@ from setuptools.extern.six.moves import configparser, map
from setuptools import Command from setuptools import Command
from setuptools.sandbox import run_setup from setuptools.sandbox import run_setup
from setuptools.py31compat import get_path, get_config_vars from setuptools.py31compat import get_path, get_config_vars
from setuptools.py27compat import rmtree_safe
from setuptools.command import setopt from setuptools.command import setopt
from setuptools.archive_util import unpack_archive from setuptools.archive_util import unpack_archive
from setuptools.package_index import ( from setuptools.package_index import (
...@@ -634,7 +635,7 @@ class easy_install(Command): ...@@ -634,7 +635,7 @@ class easy_install(Command):
# cast to str as workaround for #709 and #710 and #712 # cast to str as workaround for #709 and #710 and #712
yield str(tmpdir) yield str(tmpdir)
finally: finally:
os.path.exists(tmpdir) and rmtree(tmpdir) os.path.exists(tmpdir) and rmtree(rmtree_safe(tmpdir))
def easy_install(self, spec, deps=False): def easy_install(self, spec, deps=False):
if not self.editable: if not self.editable:
......
...@@ -3,6 +3,7 @@ Compatibility Support for Python 2.7 and earlier ...@@ -3,6 +3,7 @@ Compatibility Support for Python 2.7 and earlier
""" """
import sys import sys
import platform
def get_all_headers(message, key): def get_all_headers(message, key):
...@@ -16,3 +17,13 @@ if sys.version_info < (3,): ...@@ -16,3 +17,13 @@ if sys.version_info < (3,):
def get_all_headers(message, key): def get_all_headers(message, key):
return message.getheaders(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"""
...@@ -169,8 +169,6 @@ class TestEasyInstallTest: ...@@ -169,8 +169,6 @@ class TestEasyInstallTest:
sdist_zip.close() sdist_zip.close()
return str(sdist) 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): def test_unicode_filename_in_sdist(self, sdist_unicode, tmpdir, monkeypatch):
""" """
The install command should execute correctly even if The install command should execute correctly even if
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment