def copy_supporting_files(start_path, destination): for file in list_files(start_path): if not (file.startswith("_") or file.startswith(".")): print("copying: %s to: %s" % (file, destination)) copy_file(path.join(start_path, file), path.join(destination, file)) for dir in list_dirs(start_path): if not (dir.startswith("_") or dir.startswith(".")): print("copying: %s to: %s" % (dir, destination)) copy_tree(path.join(start_path, dir), path.join(destination, dir))
def prepare(self, values): """ apply templates to all the .sb_template files and build the fix_perms.sh script from the permissions file""" values.update(self.cfg['pxe']) utils.rmtree(self.dst) utils.copy_tree(self.path, self.dst) for root, _, files in os.walk(self.dst): for file_name in files: if file_name.endswith('.sb_template'): file_name = os.path.join(root, file_name) utils.write_template(values, file_name) utils.file_move(file_name, os.path.splitext(file_name)[0])
def gen_task_copy_files(**kw): """Copy static files into the output folder. required keyword arguments: output_folder """ # TODO: make the path for files configurable? src = os.path.join("files") dst = kw["output_folder"] flag = False for task in utils.copy_tree(src, dst): flag = True task["basename"] = "copy_files" task["uptodate"] = task.get("uptodate", []) + [config_changed(kw)] yield task if not flag: yield {"basename": "copy_files", "actions": ()}
def gen_task_copy_files(**kw): """Copy static files into the output folder. required keyword arguments: output_folder files_folders """ flag = False for src in kw["files_folders"]: dst = kw["output_folder"] real_dst = os.path.join(dst, kw["files_folders"][src]) for task in utils.copy_tree(src, real_dst, link_cutoff=dst): flag = True task["basename"] = "copy_files" task["uptodate"] = task.get("uptodate", []) + [config_changed(kw)] yield task if not flag: yield {"basename": "copy_files", "actions": ()}
def gen_task_copy_assets(**kw): """Create tasks to copy the assets of the whole theme chain. If a file is present on two themes, use the version from the "youngest" theme. Required keyword arguments: themes output_folder """ tasks = {} for theme_name in kw["themes"]: src = os.path.join(utils.get_theme_path(theme_name), "assets") dst = os.path.join(kw["output_folder"], "assets") for task in utils.copy_tree(src, dst): if task["name"] in tasks: continue tasks[task["name"]] = task task["uptodate"] = task.get("uptodate", []) + [config_changed(kw)] task["basename"] = "copy_assets" yield task
def gen_task_copy_assets(**kw): """Create tasks to copy the assets of the whole theme chain. If a file is present on two themes, use the version from the "youngest" theme. Required keyword arguments: themes output_folder """ tasks = {} for theme_name in kw['themes']: src = os.path.join(utils.get_theme_path(theme_name), 'assets') dst = os.path.join(kw['output_folder'], 'assets') for task in utils.copy_tree(src, dst): if task['name'] in tasks: continue tasks[task['name']] = task task['uptodate'] = task.get('uptodate', []) + \ [config_changed(kw)] task['basename'] = 'copy_assets' yield task
def gen_task_copy_files(**kw): """Copy static files into the output folder. required keyword arguments: output_folder files_folders """ flag = False for src in kw['files_folders']: dst = kw['output_folder'] for task in utils.copy_tree(src, os.path.join(dst, src)): flag = True task['basename'] = 'copy_files' task['uptodate'] = task.get('uptodate', []) +\ [config_changed(kw)] yield task if not flag: yield { 'basename': 'copy_files', 'actions': (), }
def add_puppet_manifests(self, fqdn): """copy the Puppet manifests to the ISO""" path = os.path.join(self.cfg['paths']['temp'], 'seedbank', fqdn, 'iso/iso/manifests') utils.copy_tree(self.cfg['paths']['puppet_manifests'], path)
def CopyFolder(origin, destination): if copy_tree(origin, destination): log.warning("Overwriting path : " + destination) else: log.info("Copying : " + destination)
def _install(self, context): copy_tree(pj(self.source_path, "bin"), pj(self.buildEnv.install_dir, "bin"), post_copy_function=add_execution_right) copy_tree(pj(self.source_path, "lib"), pj(self.buildEnv.install_dir, "lib"))