def isFile(self): """ The tar file impl. doesn't follow sym links to check file types """ try: ti=TarUtils.getTarInfo(self.__tarFilePath,self.__tarPath) while ti.issym(): ti=TarUtils.getTarInfo(self.__tarFilePath,ti.linkname) return ti.isfile() except ufsi.PathNotFoundError,e: return False
def isFile(self): """ The tar file impl. doesn't follow sym links to check file types """ try: ti = TarUtils.getTarInfo(self.__tarFilePath, self.__tarPath) while ti.issym(): ti = TarUtils.getTarInfo(self.__tarFilePath, ti.linkname) return ti.isfile() except ufsi.PathNotFoundError, e: return False
def isDir(self): """ Dirs must end in a slash char The tar file impl. doesn't follow sym links to check file types TODO: A symlink to a dir doesn't have a trailing slash. """ try: dirPath = self.__tarPath if not dirPath.endswith(self.getSeparator()): dirPath += self.getSeparator() ti = TarUtils.getTarInfo(self.__tarFilePath, dirPath) while ti.issym(): ti = TarUtils.getTarInfo(self.__tarFilePath, ti.linkname) return ti.isdir() except ufsi.PathNotFoundError, e: return False
def getSymlinkPath(self): """ """ if not self.isSymlink(): raise ufsi.NotASymlinkError('%r is not a symlink' % self.__tarPath) return ufsi.Path( TarUtils.getTarInfo(self.__tarFilePath, self.__tarPath).linkname)
def isSymlink(self): """ """ try: return TarUtils.getTarInfo(self.__tarFilePath, self.__tarPath).issym() except ufsi.PathNotFoundError, e: return False
def isDir(self): """ Dirs must end in a slash char The tar file impl. doesn't follow sym links to check file types TODO: A symlink to a dir doesn't have a trailing slash. """ try: dirPath=self.__tarPath if not dirPath.endswith(self.getSeparator()): dirPath+=self.getSeparator() ti=TarUtils.getTarInfo(self.__tarFilePath,dirPath) while ti.issym(): ti=TarUtils.getTarInfo(self.__tarFilePath,ti.linkname) return ti.isdir() except ufsi.PathNotFoundError,e: return False
def getSymlinkPath(self): """ """ if not self.isSymlink(): raise ufsi.NotASymlinkError('%r is not a symlink'%self.__tarPath) return ufsi.Path(TarUtils.getTarInfo(self.__tarFilePath, self.__tarPath).linkname)
def isSymlink(self): """ """ try: return TarUtils.getTarInfo(self.__tarFilePath, self.__tarPath).issym() except ufsi.PathNotFoundError,e: return False
def getDirList(self, pattern=None): """ TODO: a dir must end in a '/' char """ ms = TarUtils.getMembers(self.__path.getTarFilePath()) ms = map(lambda ti: ti.name, ms) ms = filter(lambda s: s.startswith(self.__tarPathStr), ms) if not ms: raise ufsi.PathNotFoundError('Path "%s" not found' % self.__path) ms = map(lambda s: s[len(self.__tarPathStr):], ms) ms = filter(lambda s: '/' not in s, ms) ms = filter(str, ms) return ms
def getDirList(self,pattern=None): """ TODO: a dir must end in a '/' char """ ms=TarUtils.getMembers(self.__path.getTarFilePath()) ms=map(lambda ti:ti.name,ms) ms=filter(lambda s:s.startswith(self.__tarPathStr),ms) if not ms: raise ufsi.PathNotFoundError('Path "%s" not found'%self.__path) ms=map(lambda s:s[len(self.__tarPathStr):],ms) ms=filter(lambda s:'/' not in s,ms) ms=filter(str,ms) return ms
def getStat(self): ti = TarUtils.getTarInfo(self.__path.getTarFilePath(), self.__tarPathStr) return TarUtils.tarInfoToDict(ti)
def getStat(self): ti=TarUtils.getTarInfo(self.__path.getTarFilePath(),self.__tarPathStr) return TarUtils.tarInfoToDict(ti)