Cleanup package builder

Simplify the for loop, add a comment, and raise an appropiate
exception.
This commit is contained in:
Craig Tracey 2014-11-15 18:44:20 -05:00
parent 70972479f1
commit 0ed189fb51
1 changed files with 7 additions and 1 deletions

View File

@ -40,13 +40,19 @@ class PackageBuilder(Builder):
def _build(self):
spec = self._spec
for project in self._spec.projects:
for project in spec.projects:
LOG.info("Beginning to build '%s'", project.name)
# if anything is in our way, see if we can get rid of it
if (os.path.exists(project.install_path) and
spec.settings.force_overwrite):
LOG.info("force_overwrite is set, so removing "
"existing path '%s'" % project.install_path)
shutil.rmtree(project.install_path)
else:
raise Exception("Install path '%s' already exists" %
project.install_path)
os.makedirs(project.install_path)
LOG.info("Fetching source code for '%s'", project.name)