aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-01-20 11:36:33 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-01-20 11:36:33 +0000
commit6cb2ac8d3a645e9bd209a04af9a6a7a3deb5a210 (patch)
tree791cdc55d6e9e5e4a3e336336cc3a0f4b7c5a8d7
parenta1707873872b3def5f016b4e247d595da721d292 (diff)
downloadmsec-6cb2ac8d3a645e9bd209a04af9a6a7a3deb5a210.tar
msec-6cb2ac8d3a645e9bd209a04af9a6a7a3deb5a210.tar.gz
msec-6cb2ac8d3a645e9bd209a04af9a6a7a3deb5a210.tar.bz2
msec-6cb2ac8d3a645e9bd209a04af9a6a7a3deb5a210.tar.xz
msec-6cb2ac8d3a645e9bd209a04af9a6a7a3deb5a210.zip
help generator for draksec gui
-rwxr-xr-xshare/draksec_help.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/share/draksec_help.py b/share/draksec_help.py
new file mode 100755
index 0000000..02222a3
--- /dev/null
+++ b/share/draksec_help.py
@@ -0,0 +1,53 @@
+#!/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