[Python-checkins] CVS: distutils/distutils/command bdist_wininst.py,1.25,1.26

Thomas Heller theller@users.sourceforge.net
Tue, 18 Dec 2001 12:13:42 -0800


Update of /cvsroot/python/distutils/distutils/command
In directory usw-pr-cvs1:/tmp/cvs-serv1092

Modified Files:
	bdist_wininst.py 
Log Message:
Second part of fix for bug [#483982] Python 2.2b2 bdist_wininst
crashes.

If no external zip-utility is found, the archive is created by the
zipfile module, which behaves different now than in 2.1: if the
zip-file is created in the root directory if the distribution, it will
contain an (empty) version of itself.

This triggered the above bug - so it's better to create the zip-file
far away in the TMP directory.


Index: bdist_wininst.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/bdist_wininst.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** bdist_wininst.py	2001/12/06 20:57:12	1.25
--- bdist_wininst.py	2001/12/18 20:13:40	1.26
***************
*** 113,123 ****
          # And make an archive relative to the root of the
          # pseudo-installation tree.
          fullname = self.distribution.get_fullname()
-         archive_basename = os.path.join(self.bdist_dir,
-                                         "%s.win32" % fullname)
- 
          arcname = self.make_archive(archive_basename, "zip",
                                      root_dir=self.bdist_dir)
          self.create_exe(arcname, fullname, self.bitmap)
  
          if not self.keep_temp:
--- 113,126 ----
          # And make an archive relative to the root of the
          # pseudo-installation tree.
+         from tempfile import mktemp
+         archive_basename = mktemp()
          fullname = self.distribution.get_fullname()
          arcname = self.make_archive(archive_basename, "zip",
                                      root_dir=self.bdist_dir)
+         # create an exe containing the zip-file
          self.create_exe(arcname, fullname, self.bitmap)
+         # remove the zip-file again
+         self.announce("removing temporary file '%s'" % arcname)
+         os.remove(arcname)
  
          if not self.keep_temp: