def render(self, dest): """ `dest' is a path (abs or rel) to the output directory, or where to write the model files to. Be extra-sure to call setContext on this particular class, it's important to render out the Jinja context correctly. """ dest = abspath(dest) if self.context is None: raise ValueError("No context set for this JinjaTemplate") with tmpdir() as tmp: PlainTemplate.render(self, tmp) for template in dir_walk(tmp, xtn=".tpl"): with open(template, 'r') as fd: tobj = Template(fd.read()) with open(template.rsplit(".", 1)[0], 'w') as obj: obj.write(tobj.render(**self.context)) rm(template) rsync(tmp, dest)
def _alter_root_break_type(rootdir): cpyf = os.path.join(rootdir, "usr/share/doc/foo/copyright") rm(cpyf) mkdir(cpyf)