Panda3D
Public Member Functions

PackageArchiveImporter Class Reference

Base class for archive-based importing. More...

Inheritance diagram for PackageArchiveImporter:
Importer PackageArchive

List of all members.

Public Member Functions

def get_archive
def get_code
 METHODS TO OVERRIDE.
def get_subfile

Detailed Description

Base class for archive-based importing.


Member Function Documentation

def get_archive (   self,
  modname 
)
Get an archive of modules.

This method should locate an archive and return a value which can be
used by get_subfile to load modules from it. The value may be a simple
pathname, an open file, or a complex object that caches information
for future imports.

Return None if the archive was not found.

Reimplemented in PackageArchive.

def get_code (   self,
  parent,
  modname,
  fqname 
)

METHODS TO OVERRIDE.

Find and retrieve the code for the given module.

parent specifies a parent module to define a context for importing. It
may be None, indicating no particular context for the search.

modname specifies a single module (not dotted) within the parent.

fqname specifies the fully-qualified module name. This is a (potentially)
dotted name from the "root" of the module namespace down to the modname.
If there is no parent, then modname==fqname.

This method should return None, a 2-tuple, or a 3-tuple.

* If the module was not found, then None should be returned.

* The first item of the 2- or 3-tuple should be the integer 0 or 1,
  specifying whether the module that was found is a package or not.

* The second item is the code object for the module (it will be
  executed within the new module's namespace). This item can also
  be a fully-loaded module object (e.g. loaded from a shared lib).

* If present, the third item is a dictionary of name/value pairs that
  will be inserted into new module before the code object is executed.
  This provided in case the module's code expects certain values (such
  as where the module was found). When the second item is a module
  object, then these names/values will be inserted *after* the module
  has been loaded/initialized.

Reimplemented from Importer.

def get_subfile (   self,
  archive,
  modname 
)
Get code from a subfile in the specified archive.

Given the specified archive (as returned by get_archive()), locate
and return a code object for the specified module name.

A 2-tuple may be returned, consisting of a code object and a dict
of name/values to place into the target module.

Return None if the subfile was not found.
 All Classes Namespaces Functions Variables Properties