def main(): #parse the users wishes parser = setup_argparse(); args = vars(parser.parse_args()) #determine what to do and create the argument object # for it. Then run it over what needs to be shot. if args.get('subparser_name') == prsr_SCRIPT: script = LSScript(args.get('input')) try: if args.get('dump', False): script.dumpDefault() return else: args.update( dict( script.run() ) ) except IOError: # We don't want to show the man behind the curtain. raise IOError("LiVSs could not find file: %s"%args.get('input')) except: raise try: # We now can create our LSRunner object. runner = LSRunner( args ) # Set up logging before running! setup_logging( args ) # Run! runner.run() except: raise
def run(self): """This is the only function worth knowing about in LSRunner, it is what starts the whole system running. """ logging.debug("RUNNING") logging.debug(self.__cfgs) ############################################### if self.__config("run_timer"): import time timer = time.time() try: if self.__config("subparser_name") == prsr_EXPORT: logging.debug("export subparser found") self.__export() elif self.__config("subparser_name") == prsr_UPDATE: self.__update() # Otherwise we are using a script, so we need to determine what we # are doing the hard way. else: self.__script() except: raise # finally save the configs in a file, if wanted. if self.__config("script_save_path", False): script = LSScript(self.__config("script_save_path")) script.dumpCfgs(self.__saveCfgs()) if self.__config("run_timer"): print("LiVSs took: %d seconds" % (time.time() - timer))