def test_make_symlink_folder(self): origin = os.path.join(self.root, self.subdir_prefix + "0") destination = os.path.join(self.root, "symlink2") self.assertTrue(os.path.exists(origin)) self.assertFalse(os.path.exists(destination)) FileSystem.symlink(origin, destination) self.assertTrue(os.path.islink(destination)) os.remove(destination) self.assertFalse(os.path.exists(destination)) self.assertTrue(os.path.exists(origin))
def test_make_symlink_file(self): origin = os.path.join(self.root, self.file_a1) destination = os.path.join(self.root, "symlink1") self.assertTrue(os.path.exists(origin)) self.assertFalse(os.path.exists(destination)) FileSystem.symlink(origin, destination) self.assertTrue(os.path.islink(destination)) os.remove(destination) self.assertFalse(os.path.exists(destination)) self.assertTrue(os.path.exists(origin))
def link(self, dest): """ Symlink a set of Gipps to a given destination :param dest: The destination directory :return: """ from StartMaja.Common import FileSystem eefs = FileSystem.find(GIPPFile.regex, self.out_path) dbls = FileSystem.find(GIPPFile.regex_dbl, self.out_path) for f in eefs + dbls: base = os.path.basename(f) FileSystem.symlink(f, os.path.join(dest, base))
def link(self, dest): """ Symlink a file to the working dir without copying it :param dest: The destination folder :return: """ from StartMaja.Common import FileSystem hdr_realpath = os.path.realpath(os.path.expanduser(self.hdr)) dbl_realpath = os.path.realpath(os.path.expanduser(self.dbl)) FileSystem.symlink(hdr_realpath, os.path.join(dest, os.path.basename(hdr_realpath))) FileSystem.symlink(dbl_realpath, os.path.join(dest, os.path.basename(dbl_realpath)))