Remove compile-directory if it exists before downloading source.

Fix annoying behavior where, after a failed compilation, it is needed to run buildout to have the compile-directory removed but have an error message, then run it again to try to compile again.
parent 51cd7a9e
......@@ -128,14 +128,11 @@ class Recipe(object):
# Download the source using hexagonit.recipe.download
if self.options['url']:
compile_dir = self.options['compile-directory']
try:
os.mkdir(compile_dir)
except OSError, e:
# leftovers from a previous failed attempt,
# download recipe will raise a clean error message
if e.errno != errno.EEXIST:
raise
if os.path.exists(compile_dir):
# leftovers from a previous failed attempt, removing it.
log.warning('Removing already existing directory %s' % compile_dir)
shutil.rmtree(compile_dir)
os.mkdir(compile_dir)
try:
opt = self.options.copy()
opt['destination'] = compile_dir
......
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