jenkins-bot has submitted this change and it was merged.
Change subject: pwb fixups for generate_* ......................................................................
pwb fixups for generate_*
1. Do not pass arguments to generate_user_files. Previously these were silently ignored, however command line arguments were supported in 2b07db2. 2. Do not force generate_user_files to be run before generate_family_files
Bug: T74503 Bug: T101838 Change-Id: I241b119fd4f6472c948797c87829d1a3ee09418a --- M pwb.py 1 file changed, 17 insertions(+), 10 deletions(-)
Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py index 45415c0..9ccb5df 100755 --- a/pwb.py +++ b/pwb.py @@ -24,7 +24,6 @@ # [3] https://bitbucket.org/ned/coveragepy/src/2c5fb3a8b81c/setup.py?at=default#cl...
import os -import re import sys import types
@@ -165,6 +164,14 @@
del httplib2
+if len(sys.argv) > 1 and sys.argv[1][0] != '-': + filename = sys.argv[1] +else: + filename = None + +# Skip the filename if one was given +args = sys.argv[(2 if filename else 1):] + # Search for user-config.py before creating one. try: # If successful, user-config.py already exists in one of the candidate @@ -178,20 +185,20 @@ except RuntimeError as err: # user-config.py to be created print("NOTE: 'user-config.py' was not found!") - print("Please follow the prompts to create it:") - run_python_file('generate_user_files.py', - ['generate_user_files.py'] + sys.argv[1:], - []) - sys.exit(1) + if not filename.startswith('generate_'): + print("Please follow the prompts to create it:") + run_python_file('generate_user_files.py', + ['generate_user_files.py'], + []) + sys.exit(1)
def main(): """Command line entry point.""" - if len(sys.argv) > 1 and not re.match('-{1,2}help', sys.argv[1]): + global filename + if filename: file_package = None tryimport_pwb() - filename = sys.argv[1] - argv = sys.argv[1:] argvu = pwb.argvu[1:] if not filename.endswith('.py'): filename += '.py' @@ -230,7 +237,7 @@ warn('Parent module %s not found: %s' % (file_package, e), ImportWarning)
- run_python_file(filename, argv, argvu, file_package) + run_python_file(filename, [filename] + args, argvu, file_package) return True else: return False
pywikibot-commits@lists.wikimedia.org