[Python-3000-checkins] r66223 - in python/branches/py3k: Lib/distutils/command/bdist_wininst.py Misc/NEWS

antoine.pitrou python-3000-checkins at python.org
Thu Sep 4 23:32:09 CEST 2008


Author: antoine.pitrou
Date: Thu Sep  4 23:32:09 2008
New Revision: 66223

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

Reviewed by Trent Nelson.



Modified:
   python/branches/py3k/Lib/distutils/command/bdist_wininst.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/distutils/command/bdist_wininst.py
==============================================================================
--- python/branches/py3k/Lib/distutils/command/bdist_wininst.py	(original)
+++ python/branches/py3k/Lib/distutils/command/bdist_wininst.py	Thu Sep  4 23:32:09 2008
@@ -260,13 +260,18 @@
             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

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Thu Sep  4 23:32:09 2008
@@ -77,6 +77,8 @@
 Library
 -------
 
+- Issue #3160: the "bdist_wininst" distutils command didn't work.
+
 - Issue #1658: tkinter changes dict size during iteration in both
     tkinter.BaseWidget and tkinter.scrolledtext.ScrolledText.
 


More information about the Python-3000-checkins mailing list