Commit 9e9b63f6 authored by Kai Lautaportti's avatar Kai Lautaportti

Merge pull request #9 from SlapOS/remove-existing

Remove compile directory if it exists before downloading source
parents 97286159 880d088c
dist
*.pyc
hexagonit.recipe.cmmi.egg-info
\ No newline at end of file
......@@ -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
......
......@@ -116,10 +116,6 @@ class NonInformativeTests(unittest.TestCase):
# expected failure
self.assertRaises(zc.buildout.UserError, recipe.install)
# User deletes the __compile__ path
build_directory = os.path.join(self.dir, 'test_parts/test__compile__')
shutil.rmtree(build_directory)
# the install should still fail, and _not_ raise an OSError
self.assertRaises(zc.buildout.UserError, recipe.install)
finally:
......
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