def _foundAllModels(codeGenerationJobs): """checks up if all model file are accessible. For internal templates the template file name is changed returns True if all templates are available, else False """ foundAll = True for job in codeGenerationJobs: for model in job.models: fileExists = doesFileExist(model.schema) fileExistsString = getOkTxt('found') if fileExists \ else getErrorTxt('missing') if not fileExists: foundAll = False logging.info(' {}\t{}'.format(fileExistsString, model.schema)) return foundAll
def _tryToFindTemplate(templateFile): """tests if the given file name is a external or an internal template. If it is an internal template, then the file name is changed to a relative path. Function return a tupel with the true or false as first element, and the file name to the found file as second element """ fileExists = False templateFileToReturn = templateFile if doesFileExist(templateFile): fileExists = True else: internalTemplateName = 'yacg/generators/templates/{}.mako'.format( templateFile) fileExists = doesFileExist(internalTemplateName) templateFileToReturn = internalTemplateName fileExistsString = getOkTxt('found') if fileExists else getErrorTxt( 'missing') logging.info(' {}\t{}'.format(fileExistsString, templateFile)) return (fileExists, templateFileToReturn)