#!/usr/bin/python #--------------------------------------------------------------- # Project : Mandrake Linux # Module : share # File : draksec_help.py # Version : $Id$ # Author : Thierry Vignaud # Created On : Sat Jan 26 17:38:39 2002 # Purpose : loads a python module and creates a help hash # for draksec. #--------------------------------------------------------------- import sys import imp import inspect header = '''package security::help; # !! THIS FILE WAS AUTO-GENERATED BY draksec_help.py !! # !! DON'T MODIFY HERE, MODIFY IN THE CVS !! use common; our %help = ( ''' footer = '''); ''' ### strings used in the rewritting function_str = ''' '%s' => N("Arguments: %s %s"), ''' ### code modulename = sys.argv[1] module = __import__(modulename) sys.stdout.write(header) for f in inspect.getmembers(module, inspect.isfunction): (args, varargs, varkw, locals) = inspect.getargspec(f[1]) doc = f[1].__doc__ if doc and len(doc) > 2: doc = doc[2:] argspec = inspect.formatargspec(args, varargs, varkw, locals) s = function_str % (f[0], argspec, doc) sys.stdout.write(s) sys.stdout.write(footer) # draksec_help.py ends here