Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Copy all files in the source path to the destination path.

To replace boilerplate strings in the source data, pass a dictionary to the
``replace`` argument where each key is the boilerplate string and the
corresponding value is the string which should replace it.

The destination file paths are also parsed through the boilerplate
replacements, so directories and file names may also be modified.

        def copy_template(src, dest, replace=None):
    """
    Copy all files in the source path to the destination path.
    
    To replace boilerplate strings in the source data, pass a dictionary to the
    ``replace`` argument where each key is the boilerplate string and the
    corresponding value is the string which should replace it.
    
    The destination file paths are also parsed through the boilerplate
    replacements, so directories and file names may also be modified.
    
    """
    for path, dirs, files in os.walk(src):
        relative_path = path[len(src):].lstrip(os.sep)
        # Replace boilerplate strings in destination directory.
        for old_val, new_val in replace.items():
            relative_path = relative_path.replace(old_val, new_val)
        os.mkdir(os.path.join(dest, relative_path))
        for i, subdir in enumerate(dirs):
            if subdir.startswith('.'):
                del dirs[i]
        for filename in files:
            if (filename.startswith('.startproject') or
                filename.endswith('.pyc')):
                continue
            src_file_path = os.path.join(path, filename)
            # Replace boilerplate strings in destination filename.
            for old_val, new_val in replace.items():
                filename = filename.replace(old_val, new_val)
            dest_file_path = os.path.join(dest, relative_path, filename)
            copy_template_file(src_file_path, dest_file_path, replace)
        


src/d/j/dj-scaffold-1.0.6/dj_scaffold/startproject.py   dj-scaffold(Download)
        replace[var] = value
 
    utils.copy_template(src, dest, replace)
 

src/d/j/dj-scaffold-HEAD/dj_scaffold/startproject.py   dj-scaffold(Download)
        replace[var] = value
 
    utils.copy_template(src, dest, replace)
 

src/d/j/dj-scaffold-1.0.6/dj_scaffold/management/commands/lbstartapp.py   dj-scaffold(Download)
        # Get any boilerplate replacement variables:
        replace = {}
        utils.copy_template(app_template, app_dir, replace)
 

src/d/j/dj-scaffold-HEAD/dj_scaffold/management/commands/lbstartapp.py   dj-scaffold(Download)
        # Get any boilerplate replacement variables:
        replace = {}
        utils.copy_template(app_template, app_dir, replace)