John Vandenberg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/209429

Change subject: Allow scripts to be located in pywikibot/
......................................................................

Allow scripts to be located in pywikibot/

Search order is ., scripts, pywikibot, to be
backwards compatible

Change-Id: I3c1682deab2959d36e7c076abc86038beb0bb585
---
M pwb.py
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/29/209429/1

diff --git a/pwb.py b/pwb.py
index b96b002..49ff9c8 100755
--- a/pwb.py
+++ b/pwb.py
@@ -191,15 +191,15 @@
         argvu = pwb.argvu[1:]
         if not filename.endswith('.py'):
             filename += '.py'
-        if not os.path.exists(filename):
-            testpath = os.path.join(os.path.split(__file__)[0],
-                                    'scripts',
+        for file_package in ('.', 'scripts', 'pywikibot'):
+            testpath = os.path.join(_pwb_dir,
+                                    file_package,
                                     filename)
-            file_package = 'scripts'
             if os.path.exists(testpath):
                 filename = testpath
-            else:
-                raise OSError("%s not found!" % filename)
+                break
+        else:
+            raise OSError("%s not found!" % filename)
 
         # When both pwb.py and the filename to run are within the current
         # working directory:

-- 
To view, visit https://gerrit.wikimedia.org/r/209429
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c1682deab2959d36e7c076abc86038beb0bb585
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jay...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to