Generate documentation for one Python package in some format. 'pathOrName' can be either a filesystem path leading to a Python package or package name whose path will be resolved by importing the top-level module. The doc file will always be saved in the current directory with
(pathOrName, builder, opts={})
| 865 | os.chdir(cwd) |
| 866 | |
| 867 | def documentPackage0(pathOrName, builder, opts={}): |
| 868 | """Generate documentation for one Python package in some format. |
| 869 | |
| 870 | 'pathOrName' can be either a filesystem path leading to a Python |
| 871 | package or package name whose path will be resolved by importing |
| 872 | the top-level module. |
| 873 | |
| 874 | The doc file will always be saved in the current directory with |
| 875 | a basename equal to that of the package, e.g. reportlab.lib. |
| 876 | """ |
| 877 | |
| 878 | # Did we get a package path with OS-dependant seperators...? |
| 879 | if os.sep in pathOrName: |
| 880 | path = pathOrName |
| 881 | name = os.path.splitext(os.path.basename(path))[0] |
| 882 | # ... or rather a package name? |
| 883 | else: |
| 884 | name = pathOrName |
| 885 | package = __import__(name) |
| 886 | # Some special care needed for dotted names. |
| 887 | if '.' in name: |
| 888 | subname = 'package' + name[find(name, '.'):] |
| 889 | package = eval(subname) |
| 890 | path = os.path.dirname(package.__file__) |
| 891 | |
| 892 | cwd = os.getcwd() |
| 893 | os.chdir(path) |
| 894 | builder.beginPackage(name) |
| 895 | os.path.walk(path, _packageWalkCallback, (builder, opts)) |
| 896 | builder.endPackage(name) |
| 897 | os.chdir(cwd) |
| 898 | |
| 899 | |
| 900 | def makeGraphicsReference(outfilename): |
no test coverage detected