cmlenz@0: #!/usr/bin/env python cmlenz@5: # -*- coding: iso8859-1 -*- cmlenz@5: # cmlenz@5: # Copyright (C) 2005 Christopher Lenz cmlenz@5: # cmlenz@5: # Bitten is free software; you can redistribute it and/or cmlenz@5: # modify it under the terms of the GNU General Public License as cmlenz@5: # published by the Free Software Foundation; either version 2 of the cmlenz@5: # License, or (at your option) any later version. cmlenz@5: # cmlenz@5: # Trac is distributed in the hope that it will be useful, cmlenz@5: # but WITHOUT ANY WARRANTY; without even the implied warranty of cmlenz@5: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU cmlenz@5: # General Public License for more details. cmlenz@5: # cmlenz@5: # You should have received a copy of the GNU General Public License cmlenz@5: # along with this program; if not, write to the Free Software cmlenz@5: # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. cmlenz@5: # cmlenz@5: # Author: Christopher Lenz cmlenz@0: cmlenz@4: import sys cmlenz@0: cmlenz@4: from bitten import BuildError cmlenz@4: from bitten.recipe import Recipe cmlenz@4: cmlenz@4: def build(): cmlenz@4: step_id = None cmlenz@4: if len(sys.argv) > 1: cmlenz@4: step_id = sys.argv[1] cmlenz@4: cmlenz@4: recipe = Recipe() cmlenz@4: steps_run = [] cmlenz@4: for step in recipe: cmlenz@4: if not step_id or step.id == step_id: cmlenz@4: print '-->', step.description or step.id cmlenz@4: for function, kw in step: cmlenz@4: function(recipe.basedir, **kw) cmlenz@4: print cmlenz@4: steps_run.append(step.id) cmlenz@4: cmlenz@4: if step_id and not step_id in steps_run: cmlenz@8: raise BuildError, 'Recipe has no step named "%s"' % step_id cmlenz@0: cmlenz@0: if __name__ == '__main__': cmlenz@4: try: cmlenz@4: build() cmlenz@4: except BuildError, e: cmlenz@8: print>>sys.stderr, 'FAILED: %s' % e cmlenz@4: sys.exit(-1) cmlenz@8: print 'SUCCESS'