# PackageArchiveImporter

from direct.pyinst.imputil import PackageArchiveImporter

Importer subclass to import from (file) archives.

## Inheritance:

PackageArchiveImporter: Importer
Importer:

## Methods of PackageArchiveImporter:

get_archive
get_code
get_subfile

## Methods of Importer:

_determine_import_context
_finish_import
_import_fromlist
_import_hook
_import_one
_import_top_module
_is_package
_load_tail
_reload_hook
get_code
install

get_archive 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.

get_code def get_code(self, parent, modname, fqname) Undocumented function.

get_subfile 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.

_determine_import_context def _determine_import_context(self, globals) Returns the context in which a module should be imported. The context could be a loaded (package) module and the imported module will be looked for within that package. The context could also be None, meaning there is no context -- the module should be looked for as a "top-level" module.

_finish_import def _finish_import(self, top, tail, fromlist) Undocumented function.

_import_fromlist def _import_fromlist(self, package, fromlist) Import any sub-modules in the "from" list.

_import_hook def _import_hook(self, name, globals=None, locals=None, fromlist=None) Python calls this hook to locate and import a module. This method attempts to load the (dotted) module name. If it cannot find it, then it delegates the import to the next import hook in the chain (where "next" is defined as the import hook that was in place at the time this Importer instance was installed).

_import_one def _import_one(self, parent, modname, fqname) Import a single module.

_import_top_module def _import_top_module(self, parent, name) Locate the top of the import tree (relative or absolute). parent defines the context in which the import should occur. See _determine_import_context() for details. Returns a tuple (module, tail). module is the loaded (top-level) module, or None if the module is not found. tail is the remaining portion of the dotted name.

_is_package def _is_package(self, module_dict) Determine if a given module (dictionary) specifies a package. The package status is in the module-level name __ispkg__. The module must also have been imported by self, so that we can reliably apply semantic meaning to __ispkg__. weaken the test to issubclass(Importer)?

_load_tail def _load_tail(self, m, tail) Import the rest of the modules, down from the top-level module. Returns the last module in the dotted list of modules.

_reload_hook def _reload_hook(self, module) Python calls this hook to reload a module.

get_code def get_code(self, parent, modname, fqname) 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.

install def install(self) Undocumented function.