Merge pull request #5482 from ambv/utf8fun

Open pyproject.toml with UTF-8 encoding in all environments
This commit is contained in:
Donald Stufft 2018-06-07 23:16:06 -04:00 committed by GitHub
commit 09cd649277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

1
news/5482.bugfix Normal file
View File

@ -0,0 +1 @@
Always read ``pyproject.toml`` as UTF-8. This fixes Unicode handling on Windows and Python 2.

View File

@ -1,5 +1,6 @@
from __future__ import absolute_import
import io
import logging
import os
import re
@ -444,7 +445,7 @@ class InstallRequirement(object):
requirements, pip will default to installing setuptools and wheel.
"""
if os.path.isfile(self.pyproject_toml):
with open(self.pyproject_toml) as f:
with io.open(self.pyproject_toml, encoding="utf-8") as f:
pp_toml = pytoml.load(f)
build_sys = pp_toml.get('build-system', {})
return (build_sys.get('requires', ['setuptools', 'wheel']), True)

View File

@ -1,2 +1,4 @@
[build-system]
requires = ["setuptools", "wheel"]
# Note: pyproject.toml is always UTF-8 🤡