Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 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
Пример #4
0
    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)
Пример #5
0
 def isSymlink(self):
     """
     """
     try:
         return TarUtils.getTarInfo(self.__tarFilePath,
                                    self.__tarPath).issym()
     except ufsi.PathNotFoundError, e:
         return False
Пример #6
0
 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
Пример #7
0
    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)
Пример #8
0
 def isSymlink(self):
     """
     """
     try:
         return TarUtils.getTarInfo(self.__tarFilePath,
                                    self.__tarPath).issym()
     except ufsi.PathNotFoundError,e:
         return False
Пример #9
0
 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
Пример #10
0
 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
Пример #11
0
 def getStat(self):
     ti = TarUtils.getTarInfo(self.__path.getTarFilePath(),
                              self.__tarPathStr)
     return TarUtils.tarInfoToDict(ti)
Пример #12
0
 def getStat(self):
     ti=TarUtils.getTarInfo(self.__path.getTarFilePath(),self.__tarPathStr)
     return TarUtils.tarInfoToDict(ti)