def render_python_template_to(src, dest, subsd, only_update=False,
                              prev_subsd=None, create_dest_dirs=True,
                              logger=None):
        """
        Overload this function if you want to use a template engine such as
        e.g. mako.
        """
        if only_update:
            if subsd == prev_subsd:
                if not missing_or_other_newer(dest, src):
                    if logger:
                        msg = ("Did not re-render {}. "
                               "(destination newer + same dict)")
                        logger.info(msg.format(src))
                    return

        with open(src, 'rt') as ifh:
            data = ifh.read()  # Don't go crazy on file size...

        if create_dest_dirs:
            dest_dir = os.path.dirname(dest)
            if not os.path.exists(dest_dir):
                make_dirs(dest_dir)

        with open(dest, 'wt') as ofh:
            ofh.write(data % subsd)
def render_python_template_to ( src , dest , subsd , only_update = False , prev_subsd = None , create_dest_dirs = True , logger = None ) : if only_update : if subsd == prev_subsd : if not missing_or_other_newer ( dest , src ) : if logger : msg = ( "Did not re-render {}. " "(destination newer + same dict)" ) logger . info ( msg . format ( src ) ) return with open ( src , 'rt' ) as ifh : data = ifh . read ( ) if create_dest_dirs : dest_dir = os . path . dirname ( dest ) if not os . path . exists ( dest_dir ) : make_dirs ( dest_dir ) with open ( dest , 'wt' ) as ofh : ofh . write ( data % subsd )
Overload this function if you want to use a template engine such as
        e.g. mako.