jenkins-bot merged this change.

View Change

Approvals: Dvorapa: Looks good to me, but someone else must approve D3r1ck01: Looks good to me, approved jenkins-bot: Verified
[bugfix] Enable -help option with similar search of pwb.py

- Use pathlib.Path to get the final path component, without its suffix
needed for calledModuleName.
- pathlib is mandatory for Python 2

Bug: T241217
Change-Id: If148b2d94a8b6be5f4821d6515a197b13912f1f5
---
M pwb.py
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/pwb.py b/pwb.py
index 945694f..3886e8e 100755
--- a/pwb.py
+++ b/pwb.py
@@ -14,7 +14,7 @@

python pwb.py -lang:de bot_tests -v
"""
-# (C) Pywikibot team, 2012-2019
+# (C) Pywikibot team, 2012-2020
#
# Distributed under the terms of the MIT license.
#
@@ -184,6 +184,11 @@
print('Now, you have to re-execute the command to start your script.')
sys.exit(1)

+try:
+ from pathlib import Path
+except ImportError: # Python 2
+ from pathlib2 import Path
+

def find_alternates(filename, script_paths):
"""Search for similar filenames in the given script paths."""
@@ -317,7 +322,10 @@
warn('Parent module %s not found: %s'
% (file_package, e), ImportWarning)

- run_python_file(filename, [filename] + args, argvu, file_package)
+ run_python_file(filename,
+ [filename] + args,
+ [Path(relative_filename).stem] + argvu[1:],
+ file_package)
return True



To view, visit change 578299. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If148b2d94a8b6be5f4821d6515a197b13912f1f5
Gerrit-Change-Number: 578299
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)