def initConfigurationFile(argPath): """ Initialize project root directory from argPath. If path will be file then will be assignet to the project configuration file If path not exists then will raise exception """ argPath = FSUtil.resolveSymlink(os.path.expanduser(argPath)) if not os.path.exists(argPath): raise Exception("Detected attempt to set directory from not existing path '%s'" % argPath) if LOG.isDebug(1): LOG.ndebug(1,"Initialize ROOT directory from path '%s'",argPath) if os.path.isfile(argPath): fileName = os.path.basename(argPath) if fileName.endswith(".jar"): Config.setJar(True) Config.setConfigFName(fileName) argPath = os.path.dirname(argPath) if os.path.isdir(argPath): #os.chdir(argPath) Config.setProjectDir(argPath)
def readConfig(path,parserName="bash-parser",auto_update=True): path = FSUtil.resolveSymlink(path) parser = ParserManger.getParserByName(parserName) if parser: parser.setAutoUpdateEnv(auto_update) parser.open(path) results = parser.results() return results else: LOG.warn("Parser '%s' not found !",parserName)