jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/588154 )
Change subject: [IMPR] rename different args variables to be more informative ......................................................................
[IMPR] rename different args variables to be more informative
- rename local_args to global_args: these are local args for pwb.py wrapper but they are global options like -family and -lang - rename args to script_args: these are options passed to the called script - rename pwb_args to unknown_args: they collect unknown global options which aren't script args because they are entered in fron of the script name
Change-Id: I1b8f604a8c56f514f05096250cfe0494d82f3d35 --- M pwb.py 1 file changed, 8 insertions(+), 8 deletions(-)
Approvals: Huji: Looks good to me, approved jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py index e50d678..c1c24a9 100755 --- a/pwb.py +++ b/pwb.py @@ -212,7 +212,7 @@ if not check_modules(): sys.exit()
-filename, args, local_args = handle_args(*sys.argv) +filename, script_args, global_args = handle_args(*sys.argv)
# Search for user-config.py before creating one. # If successful, user-config.py already exists in one of the candidate @@ -337,12 +337,12 @@ if not filename: return False
- if local_args: # don't use sys.argv - pwb_args = pwb.handle_args(local_args) - if pwb_args: + if global_args: # don't use sys.argv + unknown_args = pwb.handle_args(global_args) + if unknown_args: print('ERROR: unknown pwb.py argument{}: {}\n' - .format('' if len(pwb_args) == 1 else 's', - ', '.join(pwb_args))) + .format('' if len(unknown_args) == 1 else 's', + ', '.join(unknown_args))) return False
file_package = None @@ -378,9 +378,9 @@ warn('Parent module %s not found: %s' % (file_package, e), ImportWarning)
- if check_modules(filename) or '-help' in args: + if check_modules(filename) or '-help' in script_args: run_python_file(filename, - [filename] + args, + [filename] + script_args, [Path(filename).stem] + argvu[1:], file_package) return True