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): ...@@ -128,14 +128,11 @@ class Recipe(object):
# Download the source using hexagonit.recipe.download # Download the source using hexagonit.recipe.download
if self.options['url']: if self.options['url']:
compile_dir = self.options['compile-directory'] compile_dir = self.options['compile-directory']
try: if os.path.exists(compile_dir):
os.mkdir(compile_dir) # leftovers from a previous failed attempt, removing it.
except OSError, e: log.warning('Removing already existing directory %s' % compile_dir)
# leftovers from a previous failed attempt, shutil.rmtree(compile_dir)
# download recipe will raise a clean error message os.mkdir(compile_dir)
if e.errno != errno.EEXIST:
raise
try: try:
opt = self.options.copy() opt = self.options.copy()
opt['destination'] = compile_dir opt['destination'] = compile_dir
......
...@@ -116,10 +116,6 @@ class NonInformativeTests(unittest.TestCase): ...@@ -116,10 +116,6 @@ class NonInformativeTests(unittest.TestCase):
# expected failure # expected failure
self.assertRaises(zc.buildout.UserError, recipe.install) 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 # the install should still fail, and _not_ raise an OSError
self.assertRaises(zc.buildout.UserError, recipe.install) self.assertRaises(zc.buildout.UserError, recipe.install)
finally: 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