Changes to process_plug_in_packages.py.
- Made some pep8 corrections to parser.add_arguement().
- Added valid_integer(shell_rc) check.
- Added shell_rc shift left (which was specified in help text but not
implemented).
- Change to convert shell_rc to int for consistent processing.
lib/gen_arg.py
- Made some pep8 corrections to parser.add_arguement().
- set_pgm_arg: New function.
Change-Id: I7726c80bb3312a96ee5dc670b50e47e4d3c7aaa3
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_arg.py b/lib/gen_arg.py
index 72638cc..36fcba1 100755
--- a/lib/gen_arg.py
+++ b/lib/gen_arg.py
@@ -82,8 +82,7 @@
help='If this parameter is set to "1", %(prog)s' +
' will print only essential information, i.e. it will' +
' not echo parameters, echo commands, print the total' +
- ' run time, etc.' + default_string
- )
+ ' run time, etc.' + default_string)
elif arg_name == "test_mode":
if default is None:
default = 0
@@ -95,8 +94,7 @@
help='This means that %(prog)s should go through all the' +
' motions but not actually do anything substantial.' +
' This is mainly to be used by the developer of' +
- ' %(prog)s.' + default_string
- )
+ ' %(prog)s.' + default_string)
elif arg_name == "debug":
if default is None:
default = 0
@@ -107,8 +105,7 @@
choices=[1, 0],
help='If this parameter is set to "1", %(prog)s will print' +
' additional debug information. This is mainly to be' +
- ' used by the developer of %(prog)s.' + default_string
- )
+ ' used by the developer of %(prog)s.' + default_string)
elif arg_name == "loglevel":
if default is None:
default = "info"
@@ -120,8 +117,7 @@
'debug', 'info', 'warning', 'error', 'critical'],
help='If this parameter is set to "1", %(prog)s will print' +
' additional debug information. This is mainly to be' +
- ' used by the developer of %(prog)s.' + default_string
- )
+ ' used by the developer of %(prog)s.' + default_string)
arg_obj = parser.parse_args()
@@ -161,6 +157,37 @@
###############################################################################
+###############################################################################
+def set_pgm_arg(var_value,
+ var_name=None):
+
+ r"""
+ Set the value of the arg_obj.__dict__ entry named in var_name with the
+ var_value provided. Also, set corresponding global variable.
+
+ Description of arguments:
+ var_value The value to set in the variable.
+ var_name The name of the variable to set. This
+ defaults to the name of the variable used
+ for var_value when calling this function.
+ """
+
+ if var_name is None:
+ var_name = gp.get_arg_name(None, 1, 2)
+
+ arg_obj.__dict__[var_name] = var_value
+ module = sys.modules['__main__']
+ setattr(module, var_name, var_value)
+ if var_name == "quiet":
+ __builtin__.quiet = var_value
+ elif var_name == "debug":
+ __builtin__.debug = var_value
+ elif var_name == "test_mode":
+ __builtin__.test_mode = var_value
+
+###############################################################################
+
+
# Put this in gen_opt.py or gen_parm.py or gen_arg.py.
###############################################################################
def sprint_args(arg_obj,