jenkins-bot has submitted this change and it was merged.
Change subject: pwb.py: make sure pywikibot is correctly loaded before starting a script ......................................................................
pwb.py: make sure pywikibot is correctly loaded before starting a script
generate_user_files.py will load pywikibot with PYWIKIBOT2_NO_USER_CONFIG=2, which works correctly, but will overwrite command line arguments (pywikibot.argvu). This makes sure pywikibot is fully loaded before we try to change argv/argvu, by setting PYWIKIBOT2_NO_USER_CONFIG=2 ourselves if no user-config.py is found.
In addition, add the missing argvu parameter to generate_user_files.py.
Bug: T126880 Change-Id: I0f84e5b739942154f8fe164b47d19cfac47266c0 --- M pwb.py 1 file changed, 6 insertions(+), 3 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py index a630c5f..395019e 100755 --- a/pwb.py +++ b/pwb.py @@ -77,8 +77,9 @@ except RuntimeError: remove_modules()
- pwb = lambda: None # noqa: E731 - pwb.argvu = [] + os.environ['PYWIKIBOT2_NO_USER_CONFIG'] = '2' + import pywikibot # noqa + pwb = pywikibot
def run_python_file(filename, argv, argvu, package=None): @@ -191,7 +192,9 @@ print("Please follow the prompts to create it:") run_python_file('generate_user_files.py', ['generate_user_files.py'], - []) + ['generate_user_files.py']) + # because we have loaded pywikibot without user-config.py loaded, we need to re-start + # the entire process. Ask the user to do so. sys.exit(1)
pywikibot-commits@lists.wikimedia.org