From c7cb9ed35f878d6ac31c5b746f8b15abcc3be54d Mon Sep 17 00:00:00 2001 From: Thomas Heller Date: Tue, 18 Dec 2001 20:13:40 +0000 Subject: [PATCH] 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. --- Lib/distutils/command/bdist_wininst.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index 357ba519d31..9ff94613071 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -112,13 +112,16 @@ def run (self): # 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() - archive_basename = os.path.join(self.bdist_dir, - "%s.win32" % 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: remove_tree(self.bdist_dir, self.verbose, self.dry_run)