def test_can_recognise_mac_osx_symlink_path_type(self): """fab.tests.os.path_info_test Can recognise a Mac OS X symbolic link path type""" self._set_expected_path_type_for(SystemType.MAC_OSX, "/some/path/to/symlink", "Symbolic Link") self.mox.ReplayAll() path = PathInfo("/some/path/to/symlink", self.mock_host_controller) self.assertTrue(path.is_symlink(), "Expected a Mac OS X symbolic link path to be recognised")
def test_can_recognise_mac_osx_symlink_path_type(self): """fab.tests.os.path_info_test Can recognise a Mac OS X symbolic link path type""" self._set_expected_path_type_for(SystemType.MAC_OSX, "/some/path/to/symlink", "Symbolic Link") self.mox.ReplayAll() path = PathInfo("/some/path/to/symlink", self.mock_host_controller) self.assertTrue( path.is_symlink(), "Expected a Mac OS X symbolic link path to be recognised")
def ensure_symlink_exists(self, symlink_path, real_path, with_sudo=False): path = PathInfo(symlink_path, self.host_controller) if path.exists() and not path.is_symlink(): self.feedback.abort("Found existing path but path is not a symlink: %s" % symlink_path) elif not PathInfo(real_path, self.host_controller).exists(): self.feedback.abort("Cannot create symlink to nonexistent path: %s" % real_path) else: symlink = SymlinkInfo(symlink_path, self.host_controller) if symlink.exists() and symlink.is_linked_to(real_path): self.feedback.comment("Found expected symlink: %s" % symlink) elif symlink.exists(): self.remove_symlink(symlink_path) self.create_symlink(symlink_path, real_path, with_sudo) else: self.create_symlink(symlink_path, real_path, with_sudo)
def ensure_symlink_exists(self, symlink_path, real_path, with_sudo=False): path = PathInfo(symlink_path, self.host_controller) if path.exists() and not path.is_symlink(): self.feedback.abort( "Found existing path but path is not a symlink: %s" % symlink_path) elif not PathInfo(real_path, self.host_controller).exists(): self.feedback.abort( "Cannot create symlink to nonexistent path: %s" % real_path) else: symlink = SymlinkInfo(symlink_path, self.host_controller) if symlink.exists() and symlink.is_linked_to(real_path): self.feedback.comment("Found expected symlink: %s" % symlink) elif symlink.exists(): self.remove_symlink(symlink_path) self.create_symlink(symlink_path, real_path, with_sudo) else: self.create_symlink(symlink_path, real_path, with_sudo)