def copy_dir_contents(self, src, dst): """find and copy all files from src to dst""" utils.make_dirs(dst) files = [os.path.join(root, file_name) for root, _, files in os.walk(src) if files for file_name in files] for src in files: utils.file_copy(src, dst)
def compile(self): artifacts_path = os.path.join(self.paths["arch"], "artifacts") with open(artifacts_path, "wb") as artifacts_file: for path in utils.find_files(self.paths["arch"], ext=".art") + \ utils.find_files(self.paths["maps"], ext=".art"): utils.file_copy(path, artifacts_file)
def _move(self, dst): """search and move all files from a given directory""" utils.make_dirs(dst) files = (os.path.join(root, file_name) for root, _, files in os.walk(self.temp) if files for file_name in files) for src in files: utils.file_copy(src, dst)
def compile(self): treasures_path = os.path.join(self.paths["arch"], "treasures") with open(treasures_path, "wb") as treasures_file: for path in utils.find_files(self.paths["arch"], ext=".trs") + \ utils.find_files(self.paths["maps"], ext=".trs"): utils.file_copy(path, treasures_file)
def copy_dir_contents(self, src, dst): """find and copy all files from src to dst""" utils.make_dirs(dst) files = [ os.path.join(root, file_name) for root, _, files in os.walk(src) if files for file_name in files ] for src in files: utils.file_copy(src, dst)
def _pxe_default(self): """manage the pxelinux.cfg default file""" src = os.path.join(self.cfg['paths']['templates'], 'pxe_default') directory = os.path.join(self.cfg['paths']['tftpboot'], 'pxelinux.cfg') dst = os.path.join(directory, 'default') if os.path.isfile(dst): return logging.info('created default pxelinux.cfg file "%s"', dst) utils.make_dirs(directory) utils.file_copy(src, dst)
def compile(self): with open(os.path.join(self.paths["arch"], "archetypes"), "wb") as archetypes_file: for path in utils.find_files(self.paths["arch"], ext=".arc"): utils.file_copy(path, archetypes_file)
def compile(self): factions_path = os.path.join(self.paths["arch"], "factions") with open(factions_path, "wb") as factions_file: for path in utils.find_files(self.paths["maps"], ext=".factions"): utils.file_copy(path, factions_file)