John Vandenberg has uploaded a new change for review.

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

Change subject: Fix missing i18n git submodule on Python 3
......................................................................

Fix missing i18n git submodule on Python 3

Avoid implicit namespace in messages_available()
and twget_keys().

Bug: T110174
Change-Id: I7454bb13d499661e1467227e06a3d57286cb1dd0
---
M pywikibot/i18n.py
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/88/233688/1

diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index de78688..5be2a7f 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -81,8 +81,12 @@
     if _messages_available is not None:
         return _messages_available
     try:
-        __import__(_messages_package_name)
+        mod = __import__(_messages_package_name, fromlist=[str('__path__')])
     except ImportError:
+        _messages_available = False
+        return False
+
+    if not os.listdir(next(iter(mod.__path__))):
         _messages_available = False
         return False
 
@@ -616,7 +620,7 @@
     # obtain the directory containing all the json files for this package
     package = twtitle.split("-")[0]
     mod = __import__(_messages_package_name, fromlist=[str('__file__')])
-    pathname = os.path.join(os.path.dirname(mod.__file__), package)
+    pathname = os.path.join(next(iter(mod.__path__)), package)
 
     # build a list of languages in that directory
     langs = [filename.partition('.')[0]

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7454bb13d499661e1467227e06a3d57286cb1dd0
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to