changeset 87:17094a075fd2

core: use C.PLUGIN_EXT to know which plugin extension to use
author Goffi <goffi@goffi.org>
date Sun, 25 Dec 2016 16:41:25 +0100
parents c711be670ecd
children 3dc526bb4a5a
files src/cagou/core/cagou_main.py src/service/main.py
diffstat 2 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/cagou/core/cagou_main.py	Sun Dec 25 16:41:21 2016 +0100
+++ b/src/cagou/core/cagou_main.py	Sun Dec 25 16:41:25 2016 +0100
@@ -71,6 +71,7 @@
     # so we change it to allow backend to detect android
     sys.platform = "android"
     import mmap
+    C.PLUGIN_EXT = 'pyo'
 
 
 class NotifsIcon(IconButton):
@@ -380,13 +381,8 @@
     def _import_plugins(self):
         """import all plugins"""
         self.default_wid = None
-        if sys.platform == "android":
-            # FIXME: android hack, need to be moved to separate file
-            plugins_path = "/data/data/org.goffi.cagou.cagou/files/cagou/plugins"
-            plugin_glob = "plugin*.pyo"
-        else:
-            plugins_path = os.path.dirname(cagou.plugins.__file__)
-            plugin_glob = "plugin*.py"
+        plugins_path = os.path.dirname(cagou.plugins.__file__)
+        plugin_glob = u"plugin*." + C.PLUGIN_EXT
         plug_lst = [os.path.splitext(p)[0] for p in map(os.path.basename, glob.glob(os.path.join(plugins_path, plugin_glob)))]
 
         imported_names_main = set()  # used to avoid loading 2 times plugin with same import name
--- a/src/service/main.py	Sun Dec 25 16:41:21 2016 +0100
+++ b/src/service/main.py	Sun Dec 25 16:41:25 2016 +0100
@@ -33,6 +33,7 @@
     # sys.platform is "linux" on android by default
     # so we change it to allow backend to detect android
     sys.platform = "android"
+    C.PLUGIN_EXT = "pyo"
 from sat.core import sat_main
 from twisted.internet import reactor