From 7a80acaf446c018bd4be0b970a38466dee240d4d Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Thu, 9 Jan 2020 13:01:31 +0530 Subject: [PATCH] Tell shutil.make_archive to use Unicode paths By default, make_archive uses str paths on Python 2, which causes it to skip files with unencodable names. By passing in a unicode base_dir explicitly, it is smart enough to use unicode all the way down instead. --- tests/lib/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/lib/__init__.py b/tests/lib/__init__.py index 10c9e47d6..de30829a3 100644 --- a/tests/lib/__init__.py +++ b/tests/lib/__init__.py @@ -15,7 +15,7 @@ from textwrap import dedent from zipfile import ZipFile import pytest -from pip._vendor.six import PY2, ensure_binary +from pip._vendor.six import PY2, ensure_binary, text_type from scripttest import FoundDir, TestFileEnvironment from pip._internal.index.collector import LinkCollector @@ -1053,7 +1053,12 @@ def create_basic_wheel_for_package( path.write_bytes(ensure_binary(files[fname])) retval = script.scratch_path / archive_name - generated = shutil.make_archive(retval, 'zip', script.temp_path) + generated = shutil.make_archive( + retval, + 'zip', + root_dir=script.temp_path, + base_dir=text_type(os.curdir), + ) shutil.move(generated, retval) shutil.rmtree(script.temp_path)