def apply_patchqueue(base_repo, pq_repo, prefix): """ Link and then apply a patchqueue repository to a source repository """ status_path = Path(pq_repo.working_dir, prefix, 'status') patches_link = Path(base_repo.git_dir, 'patches', base_repo.active_branch.name) # make the directory tree for the patches within the base repo # pylint: disable=no-member patches_link.parent.mkdir(parents=True) # link the patchqueue directory for the base repo branch rel_path = relpath(str(status_path.parent), str(patches_link.parent)) patches_link.symlink_to(rel_path) # create an empty status file with status_path.open('w'): pass patches = subprocess.check_output(['guilt', 'series'], cwd=base_repo.working_dir) if patches: subprocess.check_call(['guilt', 'push', '--all'], cwd=base_repo.working_dir)
def gmx_mpi_linked(link): gmx_exe = distutils.spawn.find_executable('gmx') gmx_mpi = Path('~/gmx_mpi').expanduser() if not link: return '' else: gmx_mpi.symlink_to(gmx_exe) return str(gmx_mpi.expanduser())
def access_local(self, source): file = Path(self.path_accessed) if not file.parent.exists(): file.parent.mkdir(parents=True) summary = Path(self.path_summarized) if not Path(self.path_summarized).parent.exists(): summary.parent.mkdir(parents=True) if file.exists(): file.unlink() try: file.symlink_to(source) except OSError: print('[Content.access_local()] source file does not exists: %s' % source)