[Python-checkins] python/dist/src/Lib/distutils/command bdist_wininst.py, 1.51, 1.52

theller at users.sourceforge.net theller at users.sourceforge.net
Fri Jul 23 21:44:31 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/distutils/command
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8017

Modified Files:
	bdist_wininst.py 
Log Message:
bdist_wininst does now properly handle unicode strings or byte strings
with umlauts in the author argument and others.

Fixes sf # 993943.


Index: bdist_wininst.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** bdist_wininst.py	19 Jul 2004 09:45:46 -0000	1.51
--- bdist_wininst.py	23 Jul 2004 19:44:29 -0000	1.52
***************
*** 177,183 ****
          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.
          lines.append("[metadata]")
  
--- 177,181 ----
          metadata = self.distribution.metadata
  
!         # Write the [metadata] section.
          lines.append("[metadata]")
  
***************
*** 186,189 ****
--- 184,191 ----
          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"]:
***************
*** 191,196 ****
              if data:
                  info = info + ("\n    %s: %s" % \
!                                (string.capitalize(name), data))
!                 lines.append("%s=%s" % (name, repr(data)[1:-1]))
  
          # The [setup] section contains entries controlling
--- 193,198 ----
              if data:
                  info = info + ("\n    %s: %s" % \
!                                (string.capitalize(name), escape(data)))
!                 lines.append("%s=%s" % (name, escape(data)))
  
          # The [setup] section contains entries controlling
***************
*** 199,203 ****
          if self.install_script:
              lines.append("install_script=%s" % self.install_script)
!         lines.append("info=%s" % repr(info)[1:-1])
          lines.append("target_compile=%d" % (not self.no_target_compile))
          lines.append("target_optimize=%d" % (not self.no_target_optimize))
--- 201,205 ----
          if self.install_script:
              lines.append("install_script=%s" % self.install_script)
!         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))
***************
*** 206,210 ****
  
          title = self.title or self.distribution.get_fullname()
!         lines.append("title=%s" % repr(title)[1:-1])
          import time
          import distutils
--- 208,212 ----
  
          title = self.title or self.distribution.get_fullname()
!         lines.append("title=%s" % escape(title))
          import time
          import distutils
***************
*** 245,248 ****
--- 247,259 ----
              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"



More information about the Python-checkins mailing list