Logo Search packages:      
Sourcecode: rapid-spring version File versions  Download package

def rapid::rapid::Package::files (   self )
Download .sdp file and return the list of files in it.

Definition at line 422 of file rapid.py.

                     :
            """ Download .sdp file and return the list of files in it."""
            if self.__files:
                  return self.__files
            self.__files = []

            self.download()
            with closing(gzip.open(self.cache_file)) as f:
                  def really_read(n, field):
                        data = f.read(n)
                        if len(data) < n:
                              raise PackageFormatException(field)
                        return data

                  while True:
                        namelen = f.read(1)
                        if namelen == '': break   # normal loop termination condition
                        namelen = struct.unpack('B', namelen)[0]

                        name  = really_read(namelen, 'name')
                        md5   = really_read(16, 'md5')
                        crc32 = really_read(4, 'crc32')
                        size  = really_read(4, 'size')

                        size = struct.unpack('>L', size)[0]
                        self.__files.append(File(name, md5, crc32, size))

            return self.__files


Generated by  Doxygen 1.6.0   Back to index