def copy_file_tree(src: str,
                   dest: str,
                   ctx: Optional[Dict[str, Any]] = None,
                   option_locations: Optional[List[Tuple[str, List[str]]]] = None):
    """
    Copy the file tree under the :param:`src` directory to the :param:`dest`
    directory. Pass :param:`ctx` to support rendering the files, and pass
    :param:`option_locations` to support deleting optional files/folders.
    """
    if os.path.exists(dest):
        shutil.rmtree(dest, ignore_errors=True)
    shutil.copytree(src, dest)

    if option_locations:
        for option, paths in option_locations:
            for path in paths:
                path = os.path.join(dest, path)
                if os.path.isfile(path):
                    os.remove(path)
                else:
                    shutil.rmtree(path, ignore_errors=True)

    if 'app_bundle_module_name' in ctx:
        shutil.move(os.path.join(dest, 'app'),
                    os.path.join(dest, ctx['app_bundle_module_name']))
        shutil.move(os.path.join(dest, 'tests', 'app'),
                    os.path.join(dest, 'tests', ctx['app_bundle_module_name']))

    _render_file_tree(dest, ctx)
def copy_file_tree ( src : str , dest : str , ctx : Optional [ Dict [ str , Any ] ] = None , option_locations : Optional [ List [ Tuple [ str , List [ str ] ] ] ] = None ) : if os . path . exists ( dest ) : shutil . rmtree ( dest , ignore_errors = True ) shutil . copytree ( src , dest ) if option_locations : for option , paths in option_locations : for path in paths : path = os . path . join ( dest , path ) if os . path . isfile ( path ) : os . remove ( path ) else : shutil . rmtree ( path , ignore_errors = True ) if 'app_bundle_module_name' in ctx : shutil . move ( os . path . join ( dest , 'app' ) , os . path . join ( dest , ctx [ 'app_bundle_module_name' ] ) ) shutil . move ( os . path . join ( dest , 'tests' , 'app' ) , os . path . join ( dest , 'tests' , ctx [ 'app_bundle_module_name' ] ) ) _render_file_tree ( dest , ctx )
Copy the file tree under the :param:`src` directory to the :param:`dest`
    directory. Pass :param:`ctx` to support rendering the files, and pass
    :param:`option_locations` to support deleting optional files/folders.