Massive changes from SF 589982 (tempfile.py rewrite, by Zack

Weinberg).  This changes all uses of deprecated tempfile functions to
the recommended ones.
This commit is contained in:
Guido van Rossum 2002-08-09 16:38:32 +00:00
parent 830a5151c1
commit 3b0a3293c3
31 changed files with 134 additions and 149 deletions

View file

@ -130,8 +130,9 @@ class bdist_wininst (Command):
# And make an archive relative to the root of the
# pseudo-installation tree.
from tempfile import mktemp
archive_basename = mktemp()
from tempfile import NamedTemporaryFile
arc = NamedTemporaryFile(".zip")
archive_basename = arc.name[:-4]
fullname = self.distribution.get_fullname()
arcname = self.make_archive(archive_basename, "zip",
root_dir=self.bdist_dir)
@ -139,7 +140,7 @@ class bdist_wininst (Command):
self.create_exe(arcname, fullname, self.bitmap)
# remove the zip-file again
log.debug("removing temporary file '%s'", arcname)
os.remove(arcname)
arc.close()
if not self.keep_temp:
remove_tree(self.bdist_dir, dry_run=self.dry_run)