4Suite API Documentation

Module Ft.Lib.ImportUtil

Utilites for working with Python PEP 302 import hooks.
Copyright 2006 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/
Functions:

Functions

FindImporter(fullname)
Find a PEP 302 "loader" object for fullname
If fullname contains dots, path must be the containing package's
__path__. Returns None if the module cannot be found or imported.
FindLoader = find_loader(fullname)
Find a PEP 302 "loader" object for fullname
If fullname contains dots, path must be the containing package's __path__.
Returns None if the module cannot be found or imported. This function uses
iter_importers(), and is thus subject to the same limitations regarding
platform-specific special import locations such as the Windows registry.
GetImporter = get_importer(path_item)
Retrieve a PEP 302 importer for the given path item
The returned importer is cached in sys.path_importer_cache
if it was newly created by a path hook.

If there is no importer, a wrapper around the basic import
machinery is returned. This wrapper is never inserted into
the importer cache (None is inserted instead).

The cache (or part of it) can be cleared manually if a
rescan of sys.path_hooks is necessary.
GetLastModified(fullname)
Returns the last modified timestamp for the given module.
GetResourceFilename(package, resource)
Returns a true filesystem name for the specified resource.
GetResourceLastModified(package, resource)
Return a timestamp indicating the last-modified time of the specified resource. Raises IOError is the pathname cannot be found from the loader for 'fullname'.
GetResourceStream(package, resource)
Return a readable stream for specified resource
GetResourceString(package, resource)
Return a string containing the contents of the specified resource.
If the pathname is absolute it is retrieved starting at the path of
the importer for 'fullname'.  Otherwise, it is retrieved relative
to the module within the loader.
GetSearchPath(fullname)
IterModules = iter_modules(path=None, prefix='')
Yields (module_loader, name, ispkg) for all submodules on path, or, if path is None, all top-level modules on sys.path.
'path' should be either None or a list of paths to look for
modules in.

'prefix' is a string to output on the front of every module name
on output.
NormalizeResource(package, resource)
OsPathToResource(pathname)