Commit 36addf1e authored by Jason R. Coombs's avatar Jason R. Coombs

Monkey-patch the write_pkg_info method on Python 3.1 DistributionMetadata. Fixes #197

parent 9551d30e
......@@ -2,6 +2,13 @@
CHANGES
=======
---
3.5
---
* Issue #197: On Python 3.1, PKG-INFO is now saved in a UTF-8 encoding instead
of ``sys.getpreferredencoding`` to match the behavior on Python 2.6-3.4.
-----
3.4.4
-----
......
......@@ -7,6 +7,7 @@ import warnings
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.core import Distribution as _Distribution
from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
DistutilsSetupError)
......@@ -31,6 +32,26 @@ def _get_unpatched(cls):
_Distribution = _get_unpatched(_Distribution)
def _patch_distribution_metadata_write_pkg_info():
"""
Workaround issue #197 - Python 3.1 uses an environment-local encoding to
save the pkg_info. Monkey-patch its write_pkg_info method to correct
this undesirable behavior.
"""
if sys.version_info[:2] != (3,1):
return
# from Python 3.4
def write_pkg_info(self, base_dir):
"""Write the PKG-INFO file into the release tree.
"""
with open(os.path.join(base_dir, 'PKG-INFO'), 'w',
encoding='UTF-8') as pkg_info:
self.write_pkg_file(pkg_info)
distutils.dist.DistributionMetadata.write_pkg_info = write_pkg_info
_patch_distribution_metadata_write_pkg_info()
sequence = tuple, list
def check_importable(dist, attr, value):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment