mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
Closes #12391: temporary files are now cleaned up.
This commit is contained in:
parent
cd9f1203a4
commit
0bec35d2d0
1 changed files with 5 additions and 7 deletions
|
@ -42,10 +42,7 @@ def _move_files(files, destination):
|
||||||
|
|
||||||
:param files: a list of files to move.
|
:param files: a list of files to move.
|
||||||
:param destination: the destination directory to put on the files.
|
: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:
|
for old in files:
|
||||||
filename = os.path.split(old)[-1]
|
filename = os.path.split(old)[-1]
|
||||||
|
@ -126,8 +123,11 @@ def install_local_project(path):
|
||||||
elif _is_archive_file(path):
|
elif _is_archive_file(path):
|
||||||
logger.info('Installing from archive: %s', path)
|
logger.info('Installing from archive: %s', path)
|
||||||
_unpacked_dir = tempfile.mkdtemp()
|
_unpacked_dir = tempfile.mkdtemp()
|
||||||
shutil.unpack_archive(path, _unpacked_dir)
|
try:
|
||||||
return _run_install_from_archive(_unpacked_dir)
|
shutil.unpack_archive(path, _unpacked_dir)
|
||||||
|
return _run_install_from_archive(_unpacked_dir)
|
||||||
|
finally:
|
||||||
|
shutil.rmtree(_unpacked_dir)
|
||||||
else:
|
else:
|
||||||
logger.warning('No projects to install.')
|
logger.warning('No projects to install.')
|
||||||
return False
|
return False
|
||||||
|
@ -179,8 +179,6 @@ def install_dists(dists, path, paths=None):
|
||||||
:param path: base path to install distribution in
|
:param path: base path to install distribution in
|
||||||
:param paths: list of paths (defaults to sys.path) to look for info
|
:param paths: list of paths (defaults to sys.path) to look for info
|
||||||
"""
|
"""
|
||||||
if not path:
|
|
||||||
path = tempfile.mkdtemp()
|
|
||||||
|
|
||||||
installed_dists = []
|
installed_dists = []
|
||||||
for dist in dists:
|
for dist in dists:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue