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.
This commit is contained in:
Thomas Heller 2001-12-18 20:13:40 +00:00
parent 4b1b3bfac1
commit c7cb9ed35f
1 changed files with 6 additions and 3 deletions

View File

@ -112,13 +112,16 @@ class bdist_wininst (Command):
# And make an archive relative to the root of the # And make an archive relative to the root of the
# pseudo-installation tree. # pseudo-installation tree.
from tempfile import mktemp
archive_basename = mktemp()
fullname = self.distribution.get_fullname() fullname = self.distribution.get_fullname()
archive_basename = os.path.join(self.bdist_dir,
"%s.win32" % fullname)
arcname = self.make_archive(archive_basename, "zip", arcname = self.make_archive(archive_basename, "zip",
root_dir=self.bdist_dir) root_dir=self.bdist_dir)
# create an exe containing the zip-file
self.create_exe(arcname, fullname, self.bitmap) 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: if not self.keep_temp:
remove_tree(self.bdist_dir, self.verbose, self.dry_run) remove_tree(self.bdist_dir, self.verbose, self.dry_run)