diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2019-04-05 10:04:50 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2019-04-05 10:30:47 -0400 |
| commit | 85fa4a6bc506be12fdbd0f4cff139e7c4e3bc6a8 (patch) | |
| tree | f20e224a255c2ebc8512898236c9bcb5c8bfe383 /setuptools/dist.py | |
| parent | 393809a02ed4d0f07faec5c1f23384233e6cd68e (diff) | |
| download | python-setuptools-git-85fa4a6bc506be12fdbd0f4cff139e7c4e3bc6a8.tar.gz | |
When reading config files, require them to be encoded with UTF-8. Fixes #1702.
Diffstat (limited to 'setuptools/dist.py')
| -rw-r--r-- | setuptools/dist.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py index ae380290..9a165de0 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -35,7 +35,6 @@ from setuptools.depends import Require from setuptools import windows_support from setuptools.monkey import get_unpatched from setuptools.config import parse_configuration -from .unicode_utils import detect_encoding import pkg_resources __import__('setuptools.extern.packaging.specifiers') @@ -587,13 +586,9 @@ class Distribution(_Distribution): parser = ConfigParser() for filename in filenames: - with io.open(filename, 'rb') as fp: - encoding = detect_encoding(fp) + with io.open(filename, encoding='utf-8') as reader: if DEBUG: - self.announce(" reading %s [%s]" % ( - filename, encoding or 'locale') - ) - reader = io.TextIOWrapper(fp, encoding=encoding) + self.announce(" reading {filename}".format(**locals())) (parser.read_file if six.PY3 else parser.readfp)(reader) for section in parser.sections(): options = parser.options(section) |
