def run(self): args = base_parser.parse_args() if args.target is None: ## TODO: add the target descriptions to the help output base_parser.print_help() print self.gen_help() return targets = {} for target in self.targets: if targets.has_key(target.name): raise Exception('invalid PBJ configuration; multiple rules for %s' % target.name) targets[target.name] = target if args.list: if args.target: items = args.target.split()[1:] ## the target is "pbj target_name" if items and items[0] in targets: target = targets[items[0]] print ' '.join(target.get_completion(items[1:])) return # print args.target print ' '.join(targets.keys()) return elif args.zsh: print ZSH_OUT return if args.target in targets: target = targets[args.target] target.build(self, args.rest) else: LOG.error('Unknown target %s' % args.target)
def _resolve(self, dep): applicable = self.get_targets_for(dep) if not applicable and dep.startswith('@'): raise PBJFailed('dependency not found "%s"' % dep) changed = False for target in applicable: if target.check_depends(self): LOG.info('building dependent target "%s" (%s)' % (target.name, dep)) target.run() changed = True else: LOG.info('nothing to do for "%s" (%s)' % (target.name, dep)) return changed
def log(self, *items): if self.logger: self.logger.info(*items) else: LOG.warning('Tried to log, but no logger registered', *items)