docs/tools/codegrab.py
author rgbecker
Wed, 28 Jun 2000 14:52:43 +0000
changeset 310 cbec783cfb81
parent 287 bbd0eb35aee8
child 494 54257447cfe9
permissions -rw-r--r--
Documentation changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
     1
#codegrab.py
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
     2
"""
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
     3
This grabs various Python class, method and function
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
     4
headers and their doc strings to include in documents
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
     5
"""
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
     6
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
     7
import imp
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
     8
import types
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
     9
import string
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    10
import os
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    11
import sys
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    12
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    13
class Struct:
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    14
	pass
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    15
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    16
def getObjectsDefinedIn(modulename, directory=None):
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    17
	"""Returns two tuple of (functions, classes) defined
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    18
	in the given module.  'directory' must be the directory
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    19
	containing the script; modulename should not include
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    20
	the .py suffix"""
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    21
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    22
	if directory:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    23
		searchpath = [directory]
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    24
	else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    25
		searchpath = sys.path	# searches usual Python path
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    26
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    27
	#might be a package.  If so, check the top level
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    28
	#package is there, then recalculate the path needed
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    29
	words = string.split(modulename, '.')
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    30
	if len(words) > 1:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    31
		packagename = words[0]
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    32
		packagefound = imp.find_module(packagename, searchpath)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    33
		assert packagefound, "Package %s not found" % packagename
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    34
		(file, packagepath, description) = packagefound
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    35
		#now the full path should be known, if it is in the
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    36
		#package
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    37
		
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    38
		directory = apply(os.path.join, tuple([packagepath] + words[1:-1]))
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    39
		modulename = words[-1]
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    40
		searchpath = [directory]
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    41
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    42
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    43
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    44
	#find and import the module.
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    45
	found = imp.find_module(modulename, searchpath)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    46
	assert found, "Module %s not found" % modulename
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    47
	(file, pathname, description) = found
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    48
	mod = imp.load_module(modulename, file, pathname, description)
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
    49
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    50
	#grab the code too, minus trailing newlines
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    51
	lines = open(pathname, 'r').readlines()
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    52
	lines = map(string.rstrip, lines)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    53
	
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    54
	result = Struct()
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    55
	result.functions = []
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    56
	result.classes = []
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    57
	result.doc = mod.__doc__
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    58
	for name in dir(mod):
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    59
		value = getattr(mod, name)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    60
		if type(value) is types.FunctionType:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    61
			path, file = os.path.split(value.func_code.co_filename)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    62
			root, ext = os.path.splitext(file)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    63
			#we're possibly interested in it
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    64
			if root == modulename:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    65
				#it was defined here
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    66
				funcObj = value
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    67
				fn = Struct()
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    68
				fn.name = name
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    69
				fn.proto = getFunctionPrototype(funcObj, lines)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    70
				if funcObj.__doc__:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    71
					fn.doc = dedent(funcObj.__doc__)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    72
				else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    73
					fn.doc = '(no documentation string)'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    74
				#is it official?
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    75
				if name[0:1] == '_':
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    76
					fn.status = 'private'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    77
				elif name[-1] in '0123456789':
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    78
					fn.status = 'experimental'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    79
				else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    80
					fn.status = 'official'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    81
						
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    82
				result.functions.append(fn)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    83
		elif type(value) == types.ClassType:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    84
			if value.__module__ == modulename:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    85
				cl = Struct()
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    86
				cl.name = name
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    87
				if value.__doc__:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    88
					cl.doc = dedent(value.__doc__)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    89
				else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    90
					cl.doc = "(no documentation string)"
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    91
			
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    92
				cl.bases = []
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    93
				for base in value.__bases__:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    94
					cl.bases.append(base.__name__)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    95
				if name[0:1] == '_':
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    96
					cl.status = 'private'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    97
				elif name[-1] in '0123456789':
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    98
					cl.status = 'experimental'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
    99
				else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   100
					cl.status = 'official'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   101
				
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   102
				cl.methods = []
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   103
				#loop over dict finding methods defined here
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   104
				# Q - should we show all methods?
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   105
				# loop over dict finding methods defined here
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   106
				items = value.__dict__.items()
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   107
				items.sort()
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   108
				for (key2, value2) in items:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   109
					if type(value2) <> types.FunctionType:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   110
						continue # not a method
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   111
					elif os.path.splitext(value2.func_code.co_filename)[0] == modulename:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   112
						continue # defined in base class
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   113
					else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   114
						#we want it
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   115
						meth = Struct()
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   116
						meth.name = key2
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   117
						name2 = value2.func_code.co_name
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   118
						meth.proto = getFunctionPrototype(value2, lines)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   119
						if name2!=key2:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   120
							meth.doc = 'pointer to '+name2
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   121
							meth.proto = string.replace(meth.proto,name2,key2)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   122
						else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   123
							if value2.__doc__:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   124
								meth.doc = dedent(value2.__doc__)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   125
							else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   126
								meth.doc = "(no documentation string)"
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   127
						#is it official?
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   128
						if key2[0:1] == '_':
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   129
							meth.status = 'private'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   130
						elif key2[-1] in '0123456789':
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   131
							meth.status = 'experimental'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   132
						else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   133
							meth.status = 'official'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   134
						cl.methods.append(meth)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   135
				result.classes.append(cl)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   136
	return result
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   137
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   138
def getFunctionPrototype(f, lines):
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   139
	"""Pass in the function object and list of lines;
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   140
	it extracts the header as a multiline text block."""
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   141
	firstLineNo = f.func_code.co_firstlineno - 1
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   142
	lineNo = firstLineNo
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   143
	brackets = 0
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   144
	while 1:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   145
		line = lines[lineNo]
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   146
		for char in line:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   147
			if char == '(':
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   148
				brackets = brackets + 1
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   149
			elif char == ')':
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   150
				brackets = brackets - 1
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   151
		if brackets == 0:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   152
			break
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   153
		else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   154
			lineNo = lineNo + 1
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   155
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   156
	usefulLines = lines[firstLineNo:lineNo+1]
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   157
	return string.join(usefulLines, '\n')
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   158
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   159
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   160
def dedent(comment):
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   161
	"""Attempts to dedent the lines to the edge. Looks at no.
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   162
	of leading spaces in line 2, and removes up to that number
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   163
	of blanks from other lines."""
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   164
	commentLines = string.split(comment, '\n')
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   165
	if len(commentLines) < 2:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   166
		cleaned = map(string.lstrip, commentLines)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   167
	else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   168
		spc = 0
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   169
		for char in commentLines[1]:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   170
			if char in string.whitespace:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   171
				spc = spc + 1
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   172
			else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   173
				break
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   174
		#now check other lines
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   175
		cleaned = []
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   176
		for line in commentLines:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   177
			for i in range(min(len(line),spc)):
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   178
				if line[0] in string.whitespace:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   179
					line = line[1:]
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   180
			cleaned.append(line)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   181
	return string.join(cleaned, '\n')
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   182
						   
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   183
	
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   184
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   185
def dumpDoc(modulename, directory=None):
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   186
	"""Test support.  Just prints docco on the module
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   187
	to standard output."""
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   188
	docco = getObjectsDefinedIn(modulename, directory)
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   189
	print 'codegrab.py - ReportLab Documentation Utility'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   190
	print 'documenting', modulename + '.py'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   191
	print '-------------------------------------------------------'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   192
	print
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   193
	if docco.functions == []:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   194
		print 'No functions found'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   195
	else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   196
		print 'Functions:'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   197
		for f in docco.functions:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   198
			print f.proto
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   199
			print '    ' + f.doc
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   200
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   201
	if docco.classes == []:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   202
		print 'No classes found'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   203
	else:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   204
		print 'Classes:'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   205
		for c in docco.classes:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   206
			print c.name
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   207
			print '    ' + c.doc
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   208
			for m in c.methods:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   209
				print m.proto  # it is already indented in the file!
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   210
				print '		   ' + m.doc
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   211
			print
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   212
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   213
def test(m='reportlab.platypus.paragraph'):
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   214
	dumpDoc(m)
256
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   215
0dedfa161b21 Initial revision
andy_robinson
parents:
diff changeset
   216
if __name__=='__main__':
310
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   217
	import sys
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   218
	print 'Path to search:'
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   219
	for line in sys.path:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   220
		print '   ',line
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   221
	M = sys.argv[1:]
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   222
	if M==[]: 
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   223
		M.append('reportlab.platypus.paragraph')
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   224
	for m in M:
cbec783cfb81 Documentation changes
rgbecker
parents: 287
diff changeset
   225
		test(m)