示例#1
0
def render_all_files(render_dict, gen_dir, plugin_list=[]):
    files = gen_file_lists(_TEMPLATES_DIR, gen_dir)
    for template, target in files:
        path = os.path.dirname(target)
        if not os.path.exists(path):
            os.makedirs(path)
        with open(target, "w") as f:
            render_template(f,
                            template,
                            render_dict,
                            _TEMPLATES_DIR,
                            prefix=_TENJIN_PREFIX)
    if len(plugin_list) > 0:
        for s in plugin_list:
            plugin_dir = os.path.join(_PLUGIN_BASE_DIR, s)
            plugin_files = gen_file_lists(plugin_dir,
                                          os.path.join(gen_dir, 'plugin', s))
            for template, target in plugin_files:
                path = os.path.dirname(target)
                if not os.path.exists(path):
                    os.makedirs(path)
                with open(target, "w") as f:
                    render_template(f,
                                    template,
                                    render_dict,
                                    plugin_dir,
                                    prefix=_TENJIN_PREFIX)
示例#2
0
文件: gen_pd.py 项目: hanw/p4c-bm
def render_all_files(render_dict, gen_dir):
    files = gen_file_lists(_TEMPLATES_DIR, gen_dir)
    for template, target in files:
        path = os.path.dirname(target)
        if not os.path.exists(path):
            os.makedirs(path)
        with open(target, "w") as f:
            render_template(f, template, render_dict, _TEMPLATES_DIR,
                            prefix=_TENJIN_PREFIX)
示例#3
0
文件: gen_pd.py 项目: lguohan/p4c-bm
def render_all_files(render_dict, gen_dir):
    files = gen_file_lists(_TEMPLATES_DIR, gen_dir)
    for template, target in files:
        path = os.path.dirname(target)
        if not os.path.exists(path):
            os.makedirs(path)
        with open(target, "w") as f:
            render_template(f,
                            template,
                            render_dict,
                            _TEMPLATES_DIR,
                            prefix=_TENJIN_PREFIX)
示例#4
0
文件: gen_pd.py 项目: p4lang/p4c-bm
def render_all_files(render_dict, gen_dir, plugin_list=[]):
    files = gen_file_lists(_TEMPLATES_DIR, gen_dir)
    for template, target in files:
        path = os.path.dirname(target)
        if not os.path.exists(path):
            os.makedirs(path)
        with open(target, "w") as f:
            render_template(f, template, render_dict, _TEMPLATES_DIR,
                            prefix=_TENJIN_PREFIX)
    if len(plugin_list) > 0:
        for s in plugin_list:
            plugin_dir = os.path.join(_PLUGIN_BASE_DIR, s)
            plugin_files = gen_file_lists(plugin_dir,
                                          os.path.join(gen_dir, 'plugin', s))
            for template, target in plugin_files:
                path = os.path.dirname(target)
                if not os.path.exists(path):
                    os.makedirs(path)
                with open(target, "w") as f:
                    render_template(f, template, render_dict, plugin_dir,
                                    prefix=_TENJIN_PREFIX)