MCPcopy Create free account
hub / github.com/Distrotech/reportlab / documentPackage0

Function documentPackage0

tools/docco/graphdocpy.py:867–897  ·  view source on GitHub ↗

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={})

Source from the content-addressed store, hash-verified

865 os.chdir(cwd)
866
867def 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
900def makeGraphicsReference(outfilename):

Callers 2

makeGraphicsReferenceFunction · 0.70
mainFunction · 0.70

Calls 3

walkMethod · 0.80
endPackageMethod · 0.80
beginPackageMethod · 0.45

Tested by

no test coverage detected