Package rhnpush :: Module archive :: Class ArchiveParser
[hide private]
[frames] | no frames]

Class ArchiveParser

source code


Explode an zip or (compressed) tar archive and parse files and directories contained therein

Instance Methods [hide private]
 
__init__(self, archive, tempdir='/tmp/')
Initialize an archive parser
source code
 
__del__(self)
Cleanup temporary files and directories
source code
 
_get_archive_dir(self)
[internal] find the archive's top level directory name
source code
 
_explode_cmd(self)
[internal] find the appropriate command to open the archive
source code
 
_explode(self)
[internal] Explode a archive for neutral parsing
source code
 
_find(self, filename)
[internal] Returns the relative path to a file in the archive
source code
 
list(self, prefix='')
Return a tuple of directories and files in the archive at the given directory: prefix
source code
 
contains(self, filename)
Returns true iff the file is contained in the archive
source code
 
read(self, filename)
Returns the contents of the file, or None on error First occurence of that file in archive is returned
source code
 
direct_read(self, filename)
Returns the contens of the file, file is relative path in archive.
source code
 
zip(self, prefix='')
Create a zip archive of a (sub-)directory of the archive
source code
 
cpio(self, prefix)
Create a cpio archive of a (sub-)directory of the archive
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, archive, tempdir='/tmp/')
(Constructor)

source code 

Initialize an archive parser

Overrides: object.__init__

direct_read(self, filename)

source code 

Returns the contens of the file, file is relative path in archive. Top most level (_get_archive_dir) is automaticaly added.