jenkins-bot merged this change.

View Change

Approvals: D3r1ck01: Looks good to me, but someone else must approve Zhuyifei1999: Looks good to me, approved jenkins-bot: Verified
[IMPR] Add current directory for similar script search

This enables similar script search for
generate_user_files.py and generate_family_file.py
(and btw for pwb.py for test purpose probably)

Bug: T217195
Change-Id: I808e870307c181e5bb59e18af136e71ee990daf9
---
M pwb.py
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/pwb.py b/pwb.py
index cd0324a..204c661 100755
--- a/pwb.py
+++ b/pwb.py
@@ -184,8 +184,9 @@
file=sys.stderr)

scripts = {}
- for file_package in script_paths:
- path = file_package.split('.')
+
+ script_paths = [['.']] + script_paths # add current directory
+ for path in script_paths:
for script_name in os.listdir(os.path.join(*path)):
# remove .py for better matching
name, _, suffix = script_name.rpartition('.')
@@ -240,14 +241,17 @@
'found: {0}. Ignoring this setting.'
.format(type(config.user_script_paths)))

+ path_list = []
for file_package in script_paths:
- paths = file_package.split('.') + [filename]
+ package = file_package.split('.')
+ paths = package + [filename]
testpath = os.path.join(_pwb_dir, *paths)
if os.path.exists(testpath):
filename = testpath
break
+ path_list.append(package)
else:
- filename = find_alternates(filename, script_paths)
+ filename = find_alternates(filename, path_list)
return filename



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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I808e870307c181e5bb59e18af136e71ee990daf9
Gerrit-Change-Number: 510497
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999@gmail.com>
Gerrit-Reviewer: jenkins-bot (75)