From cc61e8da8d9a8eaa160f81a2cb992664e93bf0db Mon Sep 17 00:00:00 2001 From: Frederic Lepied Date: Tue, 30 Jul 2002 18:47:24 +0000 Subject: added print_changes and get_translation --- share/shadow.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/share/shadow.py b/share/shadow.py index e5365d7..29e6341 100755 --- a/share/shadow.py +++ b/share/shadow.py @@ -1,7 +1,7 @@ #!/usr/bin/python #--------------------------------------------------------------- # Project : Mandrake Linux -# Module : share +# Module : msec/share # File : shadow.py # Version : $Id$ # Author : Frederic Lepied @@ -53,6 +53,31 @@ def commit_changes(): if len(f[1]) >= 1 and f[1][0] != -1: apply(f[0], f[1]) +def print_changes(): + import sys + for f in FAKE.values(): + l = len(f[1]) + if l >= 1 and f[1][0] != -1: + 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 -- cgit v1.2.1