John Vandenberg has uploaded a new change for review.

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

Change subject: Fix KeyError in package_versions
......................................................................

Fix KeyError in package_versions

Replace algorithm with simpler approach that removes only pywikibot
sub-modules like 'wikipedia_family' from the package list.

Change-Id: Ic93b75b7b9e74a66ce3907fa4526e58d694492a5
---
M pywikibot/version.py
1 file changed, 4 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/59/165459/1

diff --git a/pywikibot/version.py b/pywikibot/version.py
index 1002ffb..4c02f57 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -370,12 +370,11 @@
         else:
             data[name] = info
 
-    # Remove any sub-packages which were loaded with a different name.
+    # Remove any sub-modules which were loaded with a different name.
     # e.g. 'wikipedia_family.py' is loaded as 'wikipedia'
+    _program_dir = _get_program_dir()
     for path, name in paths.items():
-        for other_path in set(paths) - set([path]):
-            if path.startswith(other_path) and not other_path.startswith(path):
-                del paths[path]
-                del data[name]
+        if _program_dir in path:
+            del data[name]
 
     return data

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic93b75b7b9e74a66ce3907fa4526e58d694492a5
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