jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/406065 )
Change subject: [bugfix] pwb.py: bad 'user-config.py' was not found ......................................................................
[bugfix] pwb.py: bad 'user-config.py' was not found
At the same time, handle the case when version.py is called like for generate_ files. Move the add of the .py suffix to get the full filename earlier to handle this case.
Bug: T185647 Change-Id: I6a749d822f9f3b96398ffc8f268434854510646d --- M pwb.py 1 file changed, 6 insertions(+), 5 deletions(-)
Approvals: Dvorapa: Looks good to me, but someone else must approve jenkins-bot: Verified Xqt: Looks good to me, approved Zoranzoki21: Looks good to me, but someone else must approve
diff --git a/pwb.py b/pwb.py index f4ff16d..30f4314 100755 --- a/pwb.py +++ b/pwb.py @@ -9,7 +9,7 @@ and it will use the package directory to store all user files, will fix up search paths so the package does not need to be installed, etc. """ -# (C) Pywikibot team, 2015-2016 +# (C) Pywikibot team, 2015-2018 # # Distributed under the terms of the MIT license. # @@ -166,6 +166,8 @@
if len(sys.argv) > 1 and sys.argv[1][0] != '-': filename = sys.argv[1] + if not filename.endswith('.py'): + filename += '.py' else: filename = None
@@ -185,8 +187,9 @@ pwb = pywikibot except RuntimeError as err: # user-config.py to be created - print("NOTE: 'user-config.py' was not found!") - if filename is not None and not filename.startswith('generate_'): + if filename is not None and not (filename.startswith('generate_') + or filename == 'version.py'): + 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'], @@ -204,8 +207,6 @@ file_package = None tryimport_pwb() argvu = pwb.argvu[1:] - if not filename.endswith('.py'): - filename += '.py' if not os.path.exists(filename): script_paths = ['scripts', 'scripts.maintenance',