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.
diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py
index 357ba51..9ff9461 100644
--- a/Lib/distutils/command/bdist_wininst.py
+++ b/Lib/distutils/command/bdist_wininst.py
@@ -112,13 +112,16 @@
# 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)