diff options
author | Georg Brandl <georg@python.org> | 2007-08-15 14:28:22 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-08-15 14:28:22 (GMT) |
commit | 116aa62bf54a39697e25f21d6cf6799f7faa1349 (patch) | |
tree | 8db5729518ed4ca88e26f1e26cc8695151ca3eb3 /Doc/library/modulefinder.rst | |
parent | 739c01d47b9118d04e5722333f0e6b4d0c8bdd9e (diff) | |
download | cpython-116aa62bf54a39697e25f21d6cf6799f7faa1349.zip cpython-116aa62bf54a39697e25f21d6cf6799f7faa1349.tar.gz cpython-116aa62bf54a39697e25f21d6cf6799f7faa1349.tar.bz2 |
Move the 3k reST doc tree in place.
Diffstat (limited to 'Doc/library/modulefinder.rst')
-rw-r--r-- | Doc/library/modulefinder.rst | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Doc/library/modulefinder.rst b/Doc/library/modulefinder.rst new file mode 100644 index 0000000..334bd5d --- /dev/null +++ b/Doc/library/modulefinder.rst @@ -0,0 +1,52 @@ + +:mod:`modulefinder` --- Find modules used by a script +===================================================== + +.. sectionauthor:: A.M. Kuchling <amk@amk.ca> + + +.. module:: modulefinder + :synopsis: Find modules used by a script. + + +.. versionadded:: 2.3 + +This module provides a :class:`ModuleFinder` class that can be used to determine +the set of modules imported by a script. ``modulefinder.py`` can also be run as +a script, giving the filename of a Python script as its argument, after which a +report of the imported modules will be printed. + + +.. function:: AddPackagePath(pkg_name, path) + + Record that the package named *pkg_name* can be found in the specified *path*. + + +.. function:: ReplacePackage(oldname, newname) + + Allows specifying that the module named *oldname* is in fact the package named + *newname*. The most common usage would be to handle how the :mod:`_xmlplus` + package replaces the :mod:`xml` package. + + +.. class:: ModuleFinder([path=None, debug=0, excludes=[], replace_paths=[]]) + + This class provides :meth:`run_script` and :meth:`report` methods to determine + the set of modules imported by a script. *path* can be a list of directories to + search for modules; if not specified, ``sys.path`` is used. *debug* sets the + debugging level; higher values make the class print debugging messages about + what it's doing. *excludes* is a list of module names to exclude from the + analysis. *replace_paths* is a list of ``(oldpath, newpath)`` tuples that will + be replaced in module paths. + + +.. method:: ModuleFinder.report() + + Print a report to standard output that lists the modules imported by the script + and their paths, as well as modules that are missing or seem to be missing. + + +.. method:: ModuleFinder.run_script(pathname) + + Analyze the contents of the *pathname* file, which must contain Python code. + |