From cfca7a80b6bdd1e5939289fcb06eb8737e4c098e Mon Sep 17 00:00:00 2001 From: Julien Malard Date: Fri, 17 Aug 2018 12:47:47 -0400 Subject: [PATCH 1/3] Default to utf-8 for csv opening. This solves problems when installing packages with unicode module or package names. --- src/pip/_internal/wheel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pip/_internal/wheel.py b/src/pip/_internal/wheel.py index 93b4768622a..6b390a78a28 100644 --- a/src/pip/_internal/wheel.py +++ b/src/pip/_internal/wheel.py @@ -7,6 +7,7 @@ import compileall import csv import hashlib +import io import logging import os.path import re @@ -80,7 +81,7 @@ def rehash(path, blocksize=1 << 20): return (digest, str(length)) # type: ignore -def open_for_csv(name, mode): +def open_for_csv(name, mode, encoding='utf8'): # type: (str, Text) -> IO if sys.version_info[0] < 3: nl = {} # type: Dict[str, Any] @@ -88,7 +89,7 @@ def open_for_csv(name, mode): else: nl = {'newline': ''} # type: Dict[str, Any] bin = '' - return open(name, mode + bin, **nl) + return io.open(name, mode + bin, **nl) def replace_python_tag(wheelname, new_tag): From 40ee62e2c571f1d771dc80bc33676e8024abb36c Mon Sep 17 00:00:00 2001 From: julienmalard Date: Thu, 10 Jan 2019 14:50:51 -0500 Subject: [PATCH 2/3] Added tests --- tests/data/src/unicode_files/setup.py | 8 ++++++++ .../__init__.py" | 0 ...56\340\252\270\340\253\215\340\252\244\340\253\207.py" | 0 3 files changed, 8 insertions(+) create mode 100644 tests/data/src/unicode_files/setup.py create mode 100644 "tests/data/src/unicode_files/\340\256\265\340\256\243\340\256\225\340\257\215\340\256\225\340\256\256\340\257\215/__init__.py" create mode 100644 "tests/data/src/unicode_files/\340\256\265\340\256\243\340\256\225\340\257\215\340\256\225\340\256\256\340\257\215/\340\252\250\340\252\256\340\252\270\340\253\215\340\252\244\340\253\207.py" diff --git a/tests/data/src/unicode_files/setup.py b/tests/data/src/unicode_files/setup.py new file mode 100644 index 00000000000..4d391bae2f6 --- /dev/null +++ b/tests/data/src/unicode_files/setup.py @@ -0,0 +1,8 @@ +from setuptools import setup, find_packages + +setup( + name="வணக்கம்", + packages=find_packages(), + version='0.0.1', + description="A sample unicode project", +) \ No newline at end of file diff --git "a/tests/data/src/unicode_files/\340\256\265\340\256\243\340\256\225\340\257\215\340\256\225\340\256\256\340\257\215/__init__.py" "b/tests/data/src/unicode_files/\340\256\265\340\256\243\340\256\225\340\257\215\340\256\225\340\256\256\340\257\215/__init__.py" new file mode 100644 index 00000000000..e69de29bb2d diff --git "a/tests/data/src/unicode_files/\340\256\265\340\256\243\340\256\225\340\257\215\340\256\225\340\256\256\340\257\215/\340\252\250\340\252\256\340\252\270\340\253\215\340\252\244\340\253\207.py" "b/tests/data/src/unicode_files/\340\256\265\340\256\243\340\256\225\340\257\215\340\256\225\340\256\256\340\257\215/\340\252\250\340\252\256\340\252\270\340\253\215\340\252\244\340\253\207.py" new file mode 100644 index 00000000000..e69de29bb2d From 2f660e22b2624d549f046f1479de39cebb9ed35c Mon Sep 17 00:00:00 2001 From: julienmalard Date: Thu, 10 Jan 2019 14:53:18 -0500 Subject: [PATCH 3/3] News item --- news/1399.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/1399.bugfix diff --git a/news/1399.bugfix b/news/1399.bugfix new file mode 100644 index 00000000000..73f27cb6fac --- /dev/null +++ b/news/1399.bugfix @@ -0,0 +1 @@ +Fix unicode filename issues on Windows \ No newline at end of file