def load_context_from_skeleton(skeleton_path): try: sys.path.insert(0, '.') ligamentfile = imp.load_source('ligamentfile', skeleton_path) except IOError: perror("Error importing skeleton.py file found in current directory") exit (1) build_context = Context() for name, task in ligamentfile.ligament_tasks.iteritems(): if isinstance(task, BuildTarget): pout("registered task '%s'" % name, groups=["debug"]) task.register_with_context(name, build_context) elif isinstance(task, list): BuildTargetList( DeferredDependency(t) for t in task ).register_with_context(name, build_context) to_expose = ( ligamentfile.exposed_tasks if "exposed_tasks" in dir(ligamentfile) else build_context.tasks) for name in to_expose: if name in build_context.tasks: build_context.expose_task(name) else: perror("task '%s' not declared in ligament file" % name) return build_context
def print_helptext(): """ print helptext for command-line interface """ pout("usage: %s [flags] [tasks]\n" " Execute tasks in order. if no tasks are specified, tries to\n" " execute task 'default'\n" " flags:\n" " -w / --watch watch files/folders for changes and update\n" " -h / --help display this helptext" % sys.argv[0])
def update_task(self, taskname, ignore_dependents=[]): pout("updating task %s" % taskname) last_value = self._gettask(taskname).value self.build_task(taskname) if last_value != self._gettask(taskname).value: dependent_order = self.resolve_dependency_graph(taskname) for index, dependent in enumerate(dependent_order): if (dependent not in ignore_dependents and self.tasks[dependent].last_build_time > 0): self.update_task( dependent, ignore_dependents=dependent_order[index:]) else: pdebug("no change in %s" % taskname)