示例#1
0
def recursive_template_action(target, source, env):
    """Render a recursive template."""

    outdir = os.path.dirname(str(target[0]))
    render_recursive_template(env['RECURSIVE_TEMPLATE'], {},
                              outdir,
                              preserve=["main.c.tpl"])
示例#2
0
def test_recursive_render(tmpdir):
    """Make sure we can actually do a recursive render."""

    out_dir = str(tmpdir)
    files, dirs = render_recursive_template('qemu_semihost_unit', {}, out_dir)

    for file in files:
        assert os.path.isfile(os.path.join(out_dir, file))

    for folder in dirs:
        assert os.path.isdir(os.path.join(out_dir, folder))
示例#3
0
def recursive_template_emitter(target, source, env):
    """Emit all of the files generated by a recursive template."""

    outdir = os.path.dirname(str(target[0]))

    files, _dirs = render_recursive_template(env['RECURSIVE_TEMPLATE'], {}, outdir, preserve=["main.c.tpl"], dry_run=True)
    target.extend([os.path.join(outdir, x) for x in files])

    for outfile in files:
        source.append(files[outfile][1])

    return target, source
示例#4
0
def test_dryrun():
    """Make sure we can get a good list of all output files."""

    files, dirs = render_recursive_template('qemu_semihost_unit', {},
                                            "output_folder",
                                            dry_run=True)

    print(files)
    assert len(files) == 9
    assert len(dirs) == 0

    # Make sure .tpl is stripped
    assert files['main.c'][0] == 'main.c.tpl'