Commit 8b883426 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

downloadunpacked: remove downloaded files after unpacking.

parent ebdf4db8
......@@ -60,10 +60,14 @@ class Recipe(object):
if parts is not None and not os.path.isdir(parts):
os.mkdir(parts)
result.append(parts)
path, _ = self._downloader(self._url, md5sum=self._md5sum)
if os.path.exists(destination):
os.unlink(destination)
shutil.copy(path, destination)
path, is_temp = self._downloader(self._url, md5sum=self._md5sum)
try:
if os.path.exists(destination):
os.unlink(destination)
shutil.copy(path, destination)
finally:
if is_temp:
os.unlink(path)
mode = self._mode
if mode is not None:
os.chmod(destination, mode)
......
......@@ -118,6 +118,8 @@ class Recipe:
setuptools.archive_util.unpack_archive(path, extract_dir)
finally:
unpatch_archive_util()
if is_temp:
os.unlink(path)
# Delete destination directory if exist
if os.path.exists(self.destination):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment