def process_templates(input_dir, target_dir, context):
    """
    _process_templates_

    Given the input dir containing a set of template,
    clone the structure under that directory into the target dir
    using the context to process any mustache templates that
    are encountered

    """
    if not target_dir.endswith('/'):
        target_dir = "{}/".format(target_dir)
    if not os.path.exists(target_dir):
        LOGGER.info('Creating: {}'.format(target_dir))
        os.makedirs(target_dir)
    replicate_directory_tree(input_dir, target_dir)
    templates = find_templates(input_dir)
    for templ in templates:
        output_file = templ.replace(input_dir, target_dir)
        output_file = output_file[:-len('.mustache')]
        render_template(templ,  output_file, context)
def process_templates ( input_dir , target_dir , context ) : if not target_dir . endswith ( '/' ) : target_dir = "{}/" . format ( target_dir ) if not os . path . exists ( target_dir ) : LOGGER . info ( 'Creating: {}' . format ( target_dir ) ) os . makedirs ( target_dir ) replicate_directory_tree ( input_dir , target_dir ) templates = find_templates ( input_dir ) for templ in templates : output_file = templ . replace ( input_dir , target_dir ) output_file = output_file [ : - len ( '.mustache' ) ] render_template ( templ , output_file , context )
_process_templates_

    Given the input dir containing a set of template,
    clone the structure under that directory into the target dir
    using the context to process any mustache templates that
    are encountered