diff options
-rw-r--r-- | CHANGES.rst | 7 | ||||
-rw-r--r-- | setuptools/msvc.py | 5 | ||||
-rw-r--r-- | setuptools/py27compat.py | 14 |
3 files changed, 25 insertions, 1 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 081e2cfe..85ba8cbf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,10 @@ +v34.4.1 +------- + +* #992: In msvc.msvc9_query_vcvarsall, ensure the + returned dicts have str values and not Unicode for + compatibilty with os.environ. + v34.4.0 ------- diff --git a/setuptools/msvc.py b/setuptools/msvc.py index d739178b..1e7a3277 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -26,6 +26,7 @@ from packaging.version import LegacyVersion from six.moves import filterfalse from .monkey import get_unpatched +from . import py27compat if platform.system() == 'Windows': from six.moves import winreg @@ -134,11 +135,13 @@ def msvc9_query_vcvarsall(ver, arch='x86', *args, **kwargs): # If error, try to set environment directly try: - return EnvironmentInfo(arch, ver).return_env() + env = EnvironmentInfo(arch, ver).return_env() except distutils.errors.DistutilsPlatformError as exc: _augment_exception(exc, ver, arch) raise + return py27compat.make_dict_values_strings(env) + def msvc14_get_vc_env(plat_spec): """ diff --git a/setuptools/py27compat.py b/setuptools/py27compat.py index 701283c8..0f924889 100644 --- a/setuptools/py27compat.py +++ b/setuptools/py27compat.py @@ -26,3 +26,17 @@ linux_py2_ascii = ( rmtree_safe = str if linux_py2_ascii else lambda x: x """Workaround for http://bugs.python.org/issue24672""" + + +def dict_values_strings(dict_): + """ + Given a dict, make sure the text values are str. + """ + if six.PY3: + return dict_ + + # When dropping Python 2.6 support, use a dict constructor + return dict( + (key, str(value)) + for key, value in dict_.iteritems() + ) |