jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/510497 )
Change subject: [IMPR] Add current directory for similar script search ......................................................................
[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(-)
Approvals: D3r1ck01: Looks good to me, but someone else must approve Zhuyifei1999: Looks good to me, approved jenkins-bot: Verified
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
pywikibot-commits@lists.wikimedia.org