# HG changeset patch # User paulb@localhost.localdomain # Date 1165070477 -3600 # Node ID 830e214e1312237d92d01dd03945848c99932dcb # Parent b2acc897e5e95e70f5d898e8befe8b57636c4620 Moved the test program's makedoc method to viewer.makedocs, fixing its contents. diff -r b2acc897e5e9 -r 830e214e1312 test.py --- a/test.py Sat Dec 02 15:40:33 2006 +0100 +++ b/test.py Sat Dec 02 15:41:17 2006 +0100 @@ -6,16 +6,6 @@ import viewer from annotate import AnnotationError, annotate_all as aa -def makedoc(viewer, module, builtins): - try: - dirname = "%s-docs" % module.name - if not os.path.exists(dirname): - os.mkdir(dirname) - viewer.makedoc(module, os.path.join(dirname, "%s%shtml" % (module.name, os.path.extsep))) - viewer.makedoc(builtins, os.path.join(dirname, "%s%shtml" % (builtins.name, os.path.extsep))) - except viewer.ViewerError, exc: - raise - if __name__ == "__main__": builtins = simplify.simplify(os.path.join("lib", "builtins.py"), 1) @@ -33,6 +23,6 @@ v.report(exc) if "-d" in sys.argv: - makedoc(viewer, module, builtins) + viewer.makedocs(module, builtins) # vim: tabstop=4 expandtab shiftwidth=4 diff -r b2acc897e5e9 -r 830e214e1312 viewer.py --- a/viewer.py Sat Dec 02 15:40:33 2006 +0100 +++ b/viewer.py Sat Dec 02 15:41:17 2006 +0100 @@ -24,6 +24,7 @@ from compiler.visitor import ASTVisitor from simplified import * import sys +import os import textwrap # Exceptions. @@ -904,4 +905,14 @@ finally: stream.close() +def makedocs(module, builtins): + try: + dirname = "%s-docs" % module.name + if not os.path.exists(dirname): + os.mkdir(dirname) + makedoc(module, os.path.join(dirname, "%s%shtml" % (module.name, os.path.extsep))) + makedoc(builtins, os.path.join(dirname, "%s%shtml" % (builtins.name, os.path.extsep))) + except ViewerError, exc: + raise + # vim: tabstop=4 expandtab shiftwidth=4