def snapshot(self, static=True): """ take snapshot of current codebase """ target_python_files = self.files(python=True) for fpath in target_python_files: report("Copying fpath @ {fpath} into shadow".format(fpath=fpath)) self>>fpath shadow_files = path(self.pth_shadow).files() shadow_python = filter(is_python, shadow_files) for fpath in shadow_python: if fpath.basename() not in [x.basename() for x in target_python_files]: report("Removing stale file @ {fpath}".format(fpath=fpath)) os.remove(fpath)
def create_shadow(self): """ returns path to a shadow of root """ name = workspace or DEFAULT_WORKSPACE_NAME shade_holder = CodeBase.shadow_container() path = os.path.join(shade_holder, name) if os.path.exists(path): if gloves_off: if self.debug: report("Gloves are off, killing ",path) #remove_recursively(path) else: err = "If the gloves aren't off, the shadow ({sh})should be uninhabited.." raise Exception, err.format(sh=path) return path
show_all_plugins(); sys.exit() else: if main=='help': show_all_plugins(); sys.exit() try: import_line = 'kinbaku.{plugin}'.format(plugin=main) plugin_mod = _import(import_line) except ImportError,e: err = "Plugin \"{p}\" not found: {e}" print err.format(p=main,e=str(e)) sys.exit() else: plugin = getattr(plugin_mod, 'plugin',None) if not plugin: report('Code not retrieve "plugin" from {mod}',mod=plugin_mod) sys.exit() #try: plugin_obj = plugin.spawn() #except TypeError: # raise Exception, signature(plugin_obj.__init__)._parameters plugin_obj.parse_args(args[1:], options) def entry(): """ """ if "--help" in sys.argv: show_all_plugins(); sys.exit() else: (options, args) = parser().parse_args() handle_main_argument(args,options)