aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Moore <p.f.moore@gmail.com>2018-08-20 15:25:14 +0100
committerPaul Moore <p.f.moore@gmail.com>2018-08-20 15:25:14 +0100
commit83c7d77abdaf4f802cd651fb59de77c72dc94cfe (patch)
tree62841a649619ec03182d2f3cec35d26f4033ae70
parentd63b6b5b9fb63c0bfb83fb91edee10114c932e54 (diff)
downloadexternal_python_setuptools-83c7d77abdaf4f802cd651fb59de77c72dc94cfe.tar.gz
external_python_setuptools-83c7d77abdaf4f802cd651fb59de77c72dc94cfe.tar.bz2
external_python_setuptools-83c7d77abdaf4f802cd651fb59de77c72dc94cfe.zip
PEP 517 hook arguments are unicode, not str (and distutils objects to that)
-rw-r--r--setuptools/build_meta.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py
index 609ea1e5..fb657a54 100644
--- a/setuptools/build_meta.py
+++ b/setuptools/build_meta.py
@@ -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