diff options
author | Eugeni Dodonov <eugeni@mandriva.org> | 2009-01-06 21:31:46 +0000 |
---|---|---|
committer | Eugeni Dodonov <eugeni@mandriva.org> | 2009-01-06 21:31:46 +0000 |
commit | ff31c9236b1fd7465ea9687fc735e8af882e780e (patch) | |
tree | eec89033b4ad0b2459fbb91fa6dd39077eeaf407 /share/shadow.py | |
parent | ab984707253940bf5ced3a379699e8d0dc757fa6 (diff) | |
download | msec-ff31c9236b1fd7465ea9687fc735e8af882e780e.tar msec-ff31c9236b1fd7465ea9687fc735e8af882e780e.tar.gz msec-ff31c9236b1fd7465ea9687fc735e8af882e780e.tar.bz2 msec-ff31c9236b1fd7465ea9687fc735e8af882e780e.tar.xz msec-ff31c9236b1fd7465ea9687fc735e8af882e780e.zip |
Updated to working version of new msec.
Conflicts:
Makefile
cron-sh/security_check.sh
share/msec.py
Diffstat (limited to 'share/shadow.py')
-rwxr-xr-x | share/shadow.py | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/share/shadow.py b/share/shadow.py deleted file mode 100755 index e49ebb4..0000000 --- a/share/shadow.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/python -#--------------------------------------------------------------- -# Project : Mandriva Linux -# Module : msec/share -# File : shadow.py -# Version : $Id$ -# Author : Frederic Lepied -# Created On : Sat Jan 26 17:38:39 2002 -# Purpose : loads a python module and creates another one -# on stdout. All the functions of the module are shadowed according -# to their doc string: "D" direct mapping, "1" indirect call but -# name + first arg used as the key and all other cases indirect -# call with the name as the key. -#--------------------------------------------------------------- - -import sys -import imp -import inspect - -### strings used in the rewritting -direct_str = """ -%s=%s.%s - -""" - -indirect_str = """ -def %s(*args): - indirect(\"%s\", %s.%s, %d, args) - -""" - -header = """ - -NONE=0 -ALL=1 -LOCAL=2 - -yes=1 -no=0 -without_password=2 -ignore=-1 - -FAKE = {} - -_force = 0 - -def local_config(val): - global _force - _force = val - -def indirect(name, func, type, args): - if type == 1: - key = (name, args[0]) - else: - key = name - FAKE[key] = (func, args) - if _force: - force_val(name) - -def commit_changes(): - for f in FAKE.values(): - if len(f[1]) >= 1 and (f[1][0] != -1 or f[0].__name__ == 'set_shell_history_size'): - f[0](*f[1]) - elif len(f[1]) == 0: - f[0]() - -def print_changes(): - import sys - for f in FAKE.values(): - l = len(f[1]) - if l >= 1 and (f[1][0] != -1 or f[0].__name__ == 'set_shell_history_size'): - name = f[0].__name__ - try: - if f[0].one_arg: - l = 1 - except AttributeError: - pass - if l == 1: - print name, get_translation(f[0], f[1][0]) - else: - sys.stdout.write(name) - for a in f[1]: - sys.stdout.write(' ' + str(a)) - sys.stdout.write('\\n') - -def get_translation(func, value): - try: - return func.arg_trans[value] - except (KeyError, AttributeError): - return value - -""" - -### code -modulename = sys.argv[1] - -module = __import__(modulename) - -sys.stdout.write(header) - -sys.stdout.write("import %s\n\n" % modulename) - -for f in inspect.getmembers(module, inspect.isfunction): - (args, varargs, varkw, locals) = inspect.getargspec(f[1]) - if f[1].__doc__ and f[1].__doc__[0] == 'D': - #argspec = inspect.formatargspec(args, varargs, varkw, locals) - s = direct_str % (f[0], modulename, f[0]) - else: - if f[1].__doc__ and f[1].__doc__[0] == '1': - type = 1 - else: - type = 0 - s = indirect_str % (f[0], f[0], modulename, f[0], type) - sys.stdout.write(s) - -# shadow.py ends here |