Commit a2599788 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

build: Remove downloaded files at the end.

parent 84fbe625
Changes
=======
0.14 (2014-10-23)
-----------------
* build: Remove downloaded files at the end.
0.13 (2014-10-08)
-----------------
* gitclone: do not delete the working copy if develop is set.
* gitclone: revision has priority over branch.
* gitclone: empty parameter equals no parameter.
......
from setuptools import setup, find_packages
version = '0.13'
version = '0.14'
name = 'slapos.recipe.build'
long_description = open("README.rst").read() + "\n" + \
open("CHANGES.txt").read() + "\n"
......
......@@ -188,6 +188,7 @@ class Script:
download = zc.buildout.download.Download(self.buildout['buildout'],
hash_name=True, cache=self.buildout['buildout'].get('download-cache'))
path, is_temp = download(url, md5sum=md5sum)
self.cleanup_file_list.append(path)
return path
def extract(self, path):
......@@ -255,6 +256,7 @@ class Script:
def __init__(self, buildout, name, options):
self.cleanup_dir_list = []
self.cleanup_file_list = []
self.options = options
self.buildout = buildout
self.name = name
......@@ -326,6 +328,13 @@ class Script:
shutil.rmtree(d)
else:
self.logger.info('Left directory %r as requested' % d)
for f in self.cleanup_file_list:
if os.path.exists(f):
if not self.keep_on_error:
self.logger.debug('Cleanup file %r' % f)
os.unlink(f)
else:
self.logger.info('Left file %r as requested' % f)
return [self.options['location']]
......@@ -346,6 +355,10 @@ class Script:
if os.path.exists(d):
self.logger.debug('Cleanup directory %r' % d)
shutil.rmtree(d)
for f in self.cleanup_file_list:
if os.path.exists(f):
self.logger.debug('Cleanup file %r' % f)
os.unlink(f)
def applyPatchList(self, patch_string, patch_options=None, patch_binary=None, cwd=None):
if patch_string is not None:
......
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