diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-07-07 11:59:31 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-07-07 11:59:31 (GMT) |
commit | 0bec35d2d07de46a904a9862a9bc6ac4d9d161b9 (patch) | |
tree | c64cc2c35627bfa72256436633df2e70989b0240 /Lib/packaging | |
parent | cd9f1203a40ae1ecd5d29b95c7a733c3077861c6 (diff) | |
download | cpython-0bec35d2d07de46a904a9862a9bc6ac4d9d161b9.zip cpython-0bec35d2d07de46a904a9862a9bc6ac4d9d161b9.tar.gz cpython-0bec35d2d07de46a904a9862a9bc6ac4d9d161b9.tar.bz2 |
Closes #12391: temporary files are now cleaned up.
Diffstat (limited to 'Lib/packaging')
-rw-r--r-- | Lib/packaging/install.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/packaging/install.py b/Lib/packaging/install.py index 551ece1..51e70df 100644 --- a/Lib/packaging/install.py +++ b/Lib/packaging/install.py @@ -42,10 +42,7 @@ def _move_files(files, destination): :param files: a list of files to move. :param destination: the destination directory to put on the files. - if not defined, create a new one, using mkdtemp """ - if not destination: - destination = tempfile.mkdtemp() for old in files: filename = os.path.split(old)[-1] @@ -126,8 +123,11 @@ def install_local_project(path): elif _is_archive_file(path): logger.info('Installing from archive: %s', path) _unpacked_dir = tempfile.mkdtemp() - shutil.unpack_archive(path, _unpacked_dir) - return _run_install_from_archive(_unpacked_dir) + try: + shutil.unpack_archive(path, _unpacked_dir) + return _run_install_from_archive(_unpacked_dir) + finally: + shutil.rmtree(_unpacked_dir) else: logger.warning('No projects to install.') return False @@ -179,8 +179,6 @@ def install_dists(dists, path, paths=None): :param path: base path to install distribution in :param paths: list of paths (defaults to sys.path) to look for info """ - if not path: - path = tempfile.mkdtemp() installed_dists = [] for dist in dists: |