summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2004-07-23 19:44:29 (GMT)
committerThomas Heller <theller@ctypes.org>2004-07-23 19:44:29 (GMT)
commitee6fd06ecf8c81e72272be8866029987cac5a483 (patch)
tree02d402c5cd7ad273de35024457504b3656e6a177 /Lib
parentb314ce91d3642aad09da657810828ef5675ec326 (diff)
downloadcpython-ee6fd06ecf8c81e72272be8866029987cac5a483.zip
cpython-ee6fd06ecf8c81e72272be8866029987cac5a483.tar.gz
cpython-ee6fd06ecf8c81e72272be8866029987cac5a483.tar.bz2
bdist_wininst does now properly handle unicode strings or byte strings
with umlauts in the author argument and others. Fixes sf # 993943.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/command/bdist_wininst.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py
index 79c95ae..506a4a2 100644
--- a/Lib/distutils/command/bdist_wininst.py
+++ b/Lib/distutils/command/bdist_wininst.py
@@ -176,36 +176,38 @@ class bdist_wininst (Command):
lines = []
metadata = self.distribution.metadata
- # Write the [metadata] section. Values are written with
- # repr()[1:-1], so they do not contain unprintable characters, and
- # are not surrounded by quote chars.
+ # Write the [metadata] section.
lines.append("[metadata]")
# 'info' will be displayed in the installer's dialog box,
# describing the items to be installed.
info = (metadata.long_description or '') + '\n'
+ # Escape newline characters
+ def escape(s):
+ return string.replace(s, "\n", "\\n")
+
for name in ["author", "author_email", "description", "maintainer",
"maintainer_email", "name", "url", "version"]:
data = getattr(metadata, name, "")
if data:
info = info + ("\n %s: %s" % \
- (string.capitalize(name), data))
- lines.append("%s=%s" % (name, repr(data)[1:-1]))
+ (string.capitalize(name), escape(data)))
+ lines.append("%s=%s" % (name, escape(data)))
# The [setup] section contains entries controlling
# the installer runtime.
lines.append("\n[Setup]")
if self.install_script:
lines.append("install_script=%s" % self.install_script)
- lines.append("info=%s" % repr(info)[1:-1])
+ lines.append("info=%s" % escape(info))
lines.append("target_compile=%d" % (not self.no_target_compile))
lines.append("target_optimize=%d" % (not self.no_target_optimize))
if self.target_version:
lines.append("target_version=%s" % self.target_version)
title = self.title or self.distribution.get_fullname()
- lines.append("title=%s" % repr(title)[1:-1])
+ lines.append("title=%s" % escape(title))
import time
import distutils
build_info = "Built %s with distutils-%s" % \
@@ -244,6 +246,15 @@ class bdist_wininst (Command):
if bitmap:
file.write(bitmapdata)
+ # Convert cfgdata from unicode to ascii, mbcs encoded
+ try:
+ unicode
+ except NameError:
+ pass
+ else:
+ if isinstance(cfgdata, unicode):
+ cfgdata = cfgdata.encode("mbcs")
+
# Append the pre-install script
cfgdata = cfgdata + "\0"
if self.pre_install_script: