jenkins-bot has submitted this change and it was merged.
Change subject: Search for scripts in maintenance folder too
......................................................................
Search for scripts in maintenance folder too
- with 38ac04438664 scripts can be found in an archive folder but mainenance
scripts must be started with preleading "maintenance/"
- join paths in the right way; otherwise we could have mixed separators
on windows os.
- simplify test for existing script
Change-Id: I02ed7a5e533eaa33c32cbd77a2c2bdcba567413c
---
M pwb.py
1 file changed, 9 insertions(+), 11 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py
index 395019e..060fea0 100755
--- a/pwb.py
+++ b/pwb.py
@@ -208,17 +208,15 @@
if not filename.endswith('.py'):
filename += '.py'
if not os.path.exists(filename):
- testpath = os.path.join(os.path.split(__file__)[0],
- 'scripts',
- filename)
- file_package = 'scripts'
- if not os.path.exists(testpath):
- testpath = os.path.join(
- os.path.split(__file__)[0], 'scripts/archive', filename)
- file_package = 'scripts.archive'
-
- if os.path.exists(testpath):
- filename = testpath
+ script_paths = ['scripts',
+ 'scripts.maintenance',
+ 'scripts.archive']
+ for file_package in script_paths:
+ paths = file_package.split('.') + [filename]
+ testpath = os.path.join(_pwb_dir, *paths)
+ if os.path.exists(testpath):
+ filename = testpath
+ break
else:
raise OSError("%s not found!" % filename)
--
To view, visit
https://gerrit.wikimedia.org/r/270279
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I02ed7a5e533eaa33c32cbd77a2c2bdcba567413c
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <Ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>