PythonEggs |
UserPreferences |
The PEAK Developers' Center | FrontPage | RecentChanges | TitleIndex | WordIndex | SiteNavigation | HelpContents |
(Just notes so far)
The following API routines will be available in the pkg_resources module as module-level functions:
These need name, version, python version, and a metadata API, as well as PEP 302 "importer" methods.
For a module that this Distribution controls, return the path for the given resource. Typically implemented as:
return os.path.join(os.path.dirname(module.__file__), resource_name)
Open the path as a file-like object, using the specified mode ('t', 'b', or 'U').
(Note that this does not necessarily return an actual file; if you need a fileno() or an actual operating system file, you should use get_filename() instead.)
Return an openable file or directory path for the given filename. If the filename is not already on the filesystem, it will be extracted to a file allocated by the ResourceManager. If the filename represents a directory, the ResourceManager will allocate files for the entire tree.
The Distribution may allocate more files than requested during this call. A trivial implementation could extract the entire archive's contents, and a complex implementation may decide to extract all object code at the same time (e.g. dll, pyd, so, etc.). Resources that are extracted before they are requested are termed "eager" resources.
This method will be called with the fully qualified name of the module. If the importer is installed on sys.meta_path, it will receive a second argument, which is None for a top-level module, or package.__path__ for submodules or subpackages. It should return a loader object if the module was found, or None if it wasn't. If find_module() raises an exception, it will be propagated to the caller, aborting the import.
See: PEP 302 Importer Protocol
This method returns the loaded module.
See: PEP 302 Loader Protocol
I started doing some of the grunt work for the runtime at:
http://svn.red-bean.com/bob/pyegg/trunk/src/pkg_resources.py
- BobIppolito