textxjinja/__init__.py
def generate_file(src_rel_file, src_file, target_file):
        """
        Generate a single target file from the given source file.
        """
        if overwrite or not os.path.exists(target_file):

            if os.path.exists(target_file):
                click.echo('Overwriting {}'.format(target_file))
                file_count.overwritten += 1
            else:
                click.echo('Creating {}'.format(target_file))
                file_count.created += 1

            if src_file.endswith('.jinja'):
                # Render using Jinja template
                with open(target_file, 'w') as f:
                    f.write(
                        env.get_template(src_rel_file).render(**context))
            else:
                # Just copy
                if not src_file == target_file:
                    shutil.copy(src_file, target_file)

        else:
            click.echo(click.style('-- NOT overwriting: ', fg='red', bold=True), nl=False)
            click.echo(target_file)
            file_count.skipped += 1

        Generate a single target file from the given source file.
        
Generate a single target file from the given source file.
Generate a single target file from the given source file .
def generate_file(src_rel_file, src_file, target_file):
        if overwrite or not os.path.exists(target_file):
            if os.path.exists(target_file):
                click.echo('Overwriting {}'.format(target_file))
                file_count.overwritten += 1
            else:
                click.echo('Creating {}'.format(target_file))
                file_count.created += 1
            if src_file.endswith('.jinja'):
                with open(target_file, 'w') as f:
                    f.write(
                        env.get_template(src_rel_file).render(**context))
            else:
                if not src_file == target_file:
                    shutil.copy(src_file, target_file)
        else:
            click.echo(click.style('-- NOT overwriting: ', fg='red', bold=True), nl=False)
            click.echo(target_file)
            file_count.skipped += 1
def generate_file ( src_rel_file , src_file , target_file ) : if overwrite or not os . path . exists ( target_file ) : if os . path . exists ( target_file ) : click . echo ( 'Overwriting {}' . format ( target_file ) ) file_count . overwritten += 1 else : click . echo ( 'Creating {}' . format ( target_file ) ) file_count . created += 1 if src_file . endswith ( '.jinja' ) : with open ( target_file , 'w' ) as f : f . write ( env . get_template ( src_rel_file ) . render ( ** context ) ) else : if not src_file == target_file : shutil . copy ( src_file , target_file ) else : click . echo ( click . style ( '-- NOT overwriting: ' , fg = 'red' , bold = True ) , nl = False ) click . echo ( target_file ) file_count . skipped += 1
Generate a single target file from the given source file.
Generate a single target file from the given source file .
"""
        Generate a single target file from the given source file.
        """ # Render using Jinja template # Just copy
src_rel_file
src_file
target_file