Issue #3160: the "bdist_wininst" distutils command didn't work.

Reviewed by Trent Nelson.
This commit is contained in:
Antoine Pitrou 2008-09-04 21:32:09 +00:00
parent 95aee6260f
commit 1d6a16bf38
2 changed files with 11 additions and 4 deletions

View File

@ -260,13 +260,18 @@ class bdist_wininst(Command):
cfgdata = cfgdata.encode("mbcs") cfgdata = cfgdata.encode("mbcs")
# Append the pre-install script # Append the pre-install script
cfgdata = cfgdata + "\0" cfgdata = cfgdata + b"\0"
if self.pre_install_script: if self.pre_install_script:
script_data = open(self.pre_install_script, "r").read() # We need to normalize newlines, so we open in text mode and
cfgdata = cfgdata + script_data + "\n\0" # 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: else:
# empty pre-install script # empty pre-install script
cfgdata = cfgdata + "\0" cfgdata = cfgdata + b"\0"
file.write(cfgdata) file.write(cfgdata)
# The 'magic number' 0x1234567B is used to make sure that the # The 'magic number' 0x1234567B is used to make sure that the

View File

@ -77,6 +77,8 @@ C API
Library Library
------- -------
- Issue #3160: the "bdist_wininst" distutils command didn't work.
- Issue #1658: tkinter changes dict size during iteration in both - Issue #1658: tkinter changes dict size during iteration in both
tkinter.BaseWidget and tkinter.scrolledtext.ScrolledText. tkinter.BaseWidget and tkinter.scrolledtext.ScrolledText.