#!/usr/bin/env python moduledir = '@MODULEDIR@' import sys from os.path import dirname, realpath if moduledir.startswith('@'): moduledir = dirname(dirname(realpath(sys.argv[0]))) sys.path.insert(0, moduledir) from matrix import graph commands = [ ("components", graph.ComponentGraph, "Create a components file from the dependancy tree"), ("dot", graph.DotGraph, "Create a graph from the dependancy tree with 'dot'"), ] print "\nCopyright (C) 2007-2008 Movial Oy\n" if len(sys.argv) < 2: print "Please specify one of the following commands:\n" for command, obj, description in commands: print " %-15s %s" % (command, description) print sys.exit(1) if sys.argv[1] == "components": g = graph.ComponentGraph(sys.argv[2:]) elif sys.argv[1] == "dot": g = graph.DotGraph(sys.argv[2:]) else: print "Unknown command", sys.argv[1] sys.exit(1) g.output()