Imported Upstream version 40.2.0 upstream/40.2.0
authorDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 14 Jan 2019 01:43:11 +0000 (10:43 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 14 Jan 2019 01:43:11 +0000 (10:43 +0900)
CHANGES.rst
setup.cfg
setup.py
setuptools/build_meta.py
setuptools/tests/test_build_meta.py

index 5c52e9405fccf1bbf76ca62866dca77ae1355cef..3169e9142eb4738f04f307068b77728b3dd5a384 100644 (file)
@@ -1,3 +1,9 @@
+v40.2.0
+-------
+
+* #1466: Fix handling of Unicode arguments in PEP 517 backend
+
+
 vv40.1.1
 --------
 
index 0304f6ffb0e5cbb61dc4e901598743fcfc19d1aa..df021971e5775e0080cb57b6223587ebc337dd78 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 40.1.1
+current_version = 40.2.0
 commit = True
 tag = True
 
index e01043aadbc4f470ec4acbdee06568ac3ed3195c..96dbbbbc6e6db15075fbca86fbeff1b3bdd8485c 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -89,7 +89,7 @@ def pypi_link(pkg_filename):
 
 setup_params = dict(
     name="setuptools",
-    version="40.1.1",
+    version="40.2.0",
     description=(
         "Easily download, build, install, upgrade, and uninstall "
         "Python packages"
index 609ea1e510c83a480f85ccd9a5d4df1f638b4a7d..fb657a5462b93a8b9c7f3065d646813da0536f9d 100644 (file)
@@ -61,6 +61,19 @@ class Distribution(setuptools.dist.Distribution):
             distutils.core.Distribution = orig
 
 
+def _to_str(s):
+    """
+    Convert a filename to a string (on Python 2, explicitly
+    a byte string, not Unicode) as distutils checks for the
+    exact type str.
+    """
+    if sys.version_info[0] == 2 and not isinstance(s, str):
+        # Assume it's Unicode, as that's what the PEP says
+        # should be provided.
+        return s.encode(sys.getfilesystemencoding())
+    return s
+
+
 def _run_setup(setup_script='setup.py'):
     # Note that we can reuse our build directory between calls
     # Correctness comes first, then optimization later
@@ -109,7 +122,7 @@ def get_requires_for_build_sdist(config_settings=None):
 
 
 def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None):
-    sys.argv = sys.argv[:1] + ['dist_info', '--egg-base', metadata_directory]
+    sys.argv = sys.argv[:1] + ['dist_info', '--egg-base', _to_str(metadata_directory)]
     _run_setup()
     
     dist_info_directory = metadata_directory
index b39b7b8f90a2cd4ea9642f6cf6060e78db99d422..a7d1af6606ddfed0256b2127cccff6856bf7f9ff 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 import os
 
 import pytest
@@ -126,3 +128,13 @@ def test_prepare_metadata_for_build_wheel(build_backend):
     dist_info = build_backend.prepare_metadata_for_build_wheel(dist_dir)
 
     assert os.path.isfile(os.path.join(dist_dir, dist_info, 'METADATA'))
+
+
+@pytest.mark.skipif('sys.version_info > (3,)')
+def test_prepare_metadata_for_build_wheel_with_str(build_backend):
+    dist_dir = os.path.abspath(str('pip-dist-info'))
+    os.makedirs(dist_dir)
+
+    dist_info = build_backend.prepare_metadata_for_build_wheel(dist_dir)
+
+    assert os.path.isfile(os.path.join(dist_dir, dist_info, 'METADATA'))