Panda3D
Public Member Functions | Public Attributes | Static Public Attributes

ZlibArchive Class Reference

Inheritance diagram for ZlibArchive:
Archive

List of all members.

Public Member Functions

def __init__
def add
def build
 Building.
def checkmagic
 Sub-methods of __init__ - override as needed #############.
def contents
 Informational methods.
def extract
def get_code
 This is what is called by FuncImporter ####### Since an Archive is flat, we ignore parent and modname.
def loadtoc
def save_toc
def save_trailer
def update_headers

Public Attributes

 lib
 os
 path
 pymagic
 start
 toc

Static Public Attributes

int HDRLEN = 12
int LEVEL = 9
string MAGIC = 'PYZ\0'
int TOCPOS = 8
dictionary TOCTMPLT = {}
int TRLLEN = 0

Detailed Description

A subclass of Archive that compresses entries with zlib
   and uses a (marshalled) dict as a table of contents

Constructor & Destructor Documentation

def __init__ (   self,
  path = None,
  start = 0 
)
 Initialize an Archive. If path is omitted, it will be an empty Archive.
 start is the seek position within path where the Archive starts.

Reimplemented from Archive.


Member Function Documentation

def add (   self,
  entry 
)
Add an entry.

   ENTRY is a sequence where entry[0] is name and entry[1] is full path name.
   zlib compress the code object, and build a toc entry

Reimplemented from Archive.

def build (   self,
  path,
  lTOC 
) [inherited]

Building.

Top level method - shouldn't need overriding #######

Create an archive file of name PATH from LTOC.

   lTOC is a 'logical TOC' - a list of (name, path, ...)
   where name is the internal (import) name,
   and path is a file to get the object from, eg './a.pyc'.
def checkmagic (   self) [inherited]

Sub-methods of __init__ - override as needed #############.

Verify version and validity of file.

Overridable.
Check to see if the file object self.lib actually has a file
we understand.

Reimplemented in CArchive.

def contents (   self) [inherited]

Informational methods.

Return a list of the contents.

   Default implementation assumes self.toc is a dict like object.

Reimplemented in CArchive.

def extract (   self,
  name 
)
Get the code object for NAME.

   Return None if name is not in the table of contents.
   Otherwise, return a tuple (ispkg, code)

Reimplemented from Archive.

def get_code (   self,
  parent,
  modname,
  fqname 
) [inherited]

This is what is called by FuncImporter ####### Since an Archive is flat, we ignore parent and modname.

The import hook.

   Called by imputil.FunctionImporter.
   Override extract to tune getting code from the Archive.
def loadtoc (   self) [inherited]
Load the table of contents.

Overridable.
Default: After magic comes an int (4 byte native) giving the
position of the TOC within self.lib.
Default: The TOC is a marshal-able string.

Reimplemented in CArchive.

def save_toc (   self,
  tocpos 
) [inherited]
Save the table of contents.

   Default - toc is a dict
   Gets marshaled to self.lib

Reimplemented in CArchive.

def save_trailer (   self,
  tocpos 
) [inherited]
Placeholder for Archives with trailers.

Reimplemented in CArchive.

def update_headers (   self,
  tocpos 
) [inherited]
Update any header data.

   Default header is  MAGIC + Python's magic + tocpos

Member Data Documentation

int HDRLEN = 12 [static]

Reimplemented from Archive.

int LEVEL = 9 [static]
lib [inherited]
string MAGIC = 'PYZ\0' [static]

Reimplemented from Archive.

os

Reimplemented from Archive.

path [inherited]
pymagic [inherited]
start [inherited]
toc [inherited]

Reimplemented in CArchive.

int TOCPOS = 8 [static]

Reimplemented from Archive.

dictionary TOCTMPLT = {} [static]

Reimplemented from Archive.

int TRLLEN = 0 [static]

Reimplemented from Archive.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties