diff options
-rw-r--r-- | README | 6 | ||||
-rwxr-xr-x | umlpy.py | 19 |
2 files changed, 17 insertions, 8 deletions
@@ -3,8 +3,8 @@ Python source files. It uses graphviz Python bindings and the dot layout for graph generation and epydoc internals for source introspection. The most basic usage of this software is to simply pass it the name of the -modules you want to graph (you obviously need to be in the right directory) : - $ python umlpy.py mysource.py mymodule +modules you want to graph (which have to be in your PythonPath) : + $ python umlpy.py mymodule mypackage The result will be written to the uml.pdf file by default. The output filename can be modified using the -o (or --output) option. The output format is set using one of the --png, --pdf and --jpg options. @@ -31,7 +31,7 @@ symmetric options are used (that is, using --all-methods together with The example.py distributed with this software shows how to correctly use the docstrings. The example.png file shows the corresponding output, which was produced by running - $ python umlpy.py --png -o example.png -p "example." + $ python umlpy.py --png -o example.png -p "example." example The umlpy.png file shows the software output for its own source file. @@ -38,26 +38,27 @@ import re from optparse import OptionParser -parser = OptionParser () +usage = "usage: %prog [options] module ..." +parser = OptionParser (usage = usage) parser.add_option("-v", dest = "debug", action = "store_true", default = False, help = "enables debug output") parser.add_option("-e", "--exclude", dest = "excludes", action = "append", default = [], help = "classes matching this regexp will be excluded \ - from display") +from display") parser.add_option("-i", "--include", dest = "includes", action = "append", default = [], help = "classes matching this regexp will be included \ - in display even if they were excluded by exclude \ - regexps") +in display even if they were excluded by exclude \ +regexps") parser.add_option("-p", "--prefix", dest = "prefix", action = "store", default = "", help = "prefix which will be stripped of class names") parser.add_option("-f", "--force", dest = "forces", action = "append", default = [], help = "classes matching this regexp will be forced into \ - display") +display") parser.add_option("--all-methods", dest = "all_methods", action = "store_true", default = False, help = "shows all methods") @@ -497,4 +498,12 @@ class UmlPy (object): if __name__ == "__main__": (options, args) = parser.parse_args () + if not args: + parser.error ("please specify at least one module") + if options.all_methods and options.no_method: + parser.error ("options --all-methods and --no-method are \ +mutually exclusive") + if options.all_properties and options.no_property: + parser.error ("options --all-properties and --no-property are \ +mutually exclusive") UmlPy (args, options) |