diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2009-09-12 12:38:35 +0200 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2009-09-12 12:38:35 +0200 |
commit | 0fb87f9bdf3dd85bc4a0e2f17f2a7c98d0d0cf53 (patch) | |
tree | 3d55b63cd0a2ab7cef80e42b34017c935086a074 /setuptools/command/egg_info.py | |
parent | 120542187d770d1698dcd01e10a2a6d47b89850d (diff) | |
download | external_python_setuptools-0fb87f9bdf3dd85bc4a0e2f17f2a7c98d0d0cf53.tar.gz external_python_setuptools-0fb87f9bdf3dd85bc4a0e2f17f2a7c98d0d0cf53.tar.bz2 external_python_setuptools-0fb87f9bdf3dd85bc4a0e2f17f2a7c98d0d0cf53.zip |
Explicitly encode data as UTF-8 before writing to a binary file.
--HG--
branch : distribute
extra : rebase_source : c9de4f92e3e50dd88fd1d29e2a9b2f3288fd4b88
Diffstat (limited to 'setuptools/command/egg_info.py')
-rwxr-xr-x | setuptools/command/egg_info.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index a8315d23..46cdf4e0 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -3,7 +3,7 @@ Create a distribution's .egg-info directory and contents""" # This module should be kept compatible with Python 2.3 -import os, re +import os, re, sys from setuptools import Command from distutils.errors import * from distutils import log @@ -148,6 +148,8 @@ class egg_info(Command): to the file. """ log.info("writing %s to %s", what, filename) + if sys.version_info >= (3,): + data = data.encode("utf-8") if not self.dry_run: f = open(filename, 'wb') f.write(data) @@ -351,8 +353,11 @@ def write_file (filename, contents): """Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it. """ + contents = "\n".join(contents) + if sys.version_info >= (3,): + contents = contents.encode("utf-8") f = open(filename, "wb") # always write POSIX-style manifest - f.write("\n".join(contents)) + f.write(contents) f.close() |