summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2008-09-04 21:32:09 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2008-09-04 21:32:09 (GMT)
commit1d6a16bf3838bfb89efdd5e338b247324d962010 (patch)
tree89c91792c5606030e453325e0dcfca9cbc70e927 /Lib
parent95aee6260fc6a8fa03df3a5c9217e20c8ab8f3f7 (diff)
downloadcpython-1d6a16bf3838bfb89efdd5e338b247324d962010.zip
cpython-1d6a16bf3838bfb89efdd5e338b247324d962010.tar.gz
cpython-1d6a16bf3838bfb89efdd5e338b247324d962010.tar.bz2
Issue #3160: the "bdist_wininst" distutils command didn't work.
Reviewed by Trent Nelson.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/command/bdist_wininst.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py
index ae7d4fd..e997e8f 100644
--- a/Lib/distutils/command/bdist_wininst.py
+++ b/Lib/distutils/command/bdist_wininst.py
@@ -260,13 +260,18 @@ class bdist_wininst(Command):
cfgdata = cfgdata.encode("mbcs")
# Append the pre-install script
- cfgdata = cfgdata + "\0"
+ cfgdata = cfgdata + b"\0"
if self.pre_install_script:
- script_data = open(self.pre_install_script, "r").read()
- cfgdata = cfgdata + script_data + "\n\0"
+ # We need to normalize newlines, so we open in text mode and
+ # convert back to bytes. "latin1" simply avoids any possible
+ # failures.
+ with open(self.pre_install_script, "r",
+ encoding="latin1") as script:
+ script_data = script.read().encode("latin1")
+ cfgdata = cfgdata + script_data + b"\n\0"
else:
# empty pre-install script
- cfgdata = cfgdata + "\0"
+ cfgdata = cfgdata + b"\0"
file.write(cfgdata)
# The 'magic number' 0x1234567B is used to make sure that the