def render(search_root, project):
template_paths = []
matrix_dirs = []
# traverse filesystem once and find out all matrix.yml and templates
for cur_dir, dirs, files in os.walk(search_root):
# TODO: hornor .gitignore
for f in files:
if f == 'matrix.yml':
logger.info('Found matrix in %s', cur_dir)
matrix_dirs.append(cur_dir)
elif f.endswith('.jinja'):
template_paths.append(os.path.join(cur_dir, f))
# register templates with jinja environment
jinja2_env = jinja2.Environment(loader=FilesLoader(template_paths))
for maxtrix_dir in matrix_dirs:
if project and os.path.basename(maxtrix_dir) != project:
continue
render_matrix(jinja2_env, maxtrix_dir)
评论列表
文章目录