diff src/core/sat_main.py @ 2089:0931b5a6213c

core, quick_frontends: android compatibility hacks: a couple of hacks have been used so backend can be launched on android using kivy - config file (sat.conf) is been read on a specific dir, using a detection of Cagou domains in constants.py - fixed crash when using sys.stdout.isatty in log_config.py - Q&D fix for logging encoding issue on android - when android is detected, the path/pattern to load plugins is modified - SRV is not working at the moment on android. If the platform is detected, the host is used directly with default port. A hosts_dir configuration can be used in [android] section to map a specific ip to a host - getRepositoryData in tools/utils return constant string on android. Proper repository data need to be copied during package building. - [quick app] more robust failure handling on asyncConnect error - [quick chat] default to utf-8 when getlocale doesn't return the actual locale.
author Goffi <goffi@goffi.org>
date Sun, 04 Dec 2016 18:16:48 +0100
parents c02f96756d5c
children fbeeba721954
line wrap: on
line diff
--- a/src/core/sat_main.py	Sun Dec 04 18:16:37 2016 +0100
+++ b/src/core/sat_main.py	Sun Dec 04 18:16:48 2016 +0100
@@ -150,13 +150,20 @@
         ui_contact_list.ContactList(self)
         ui_profile_manager.ProfileManager(self)
         self.initialised.callback(None)
-        log.info(_("Backend is ready"))
+        log.info(_(u"Backend is ready"))
 
     def _import_plugins(self):
         """Import all plugins found in plugins directory"""
-        import sat.plugins
-        plugins_path = os.path.dirname(sat.plugins.__file__)
-        plug_lst = [os.path.splitext(plugin)[0] for plugin in map(os.path.basename, glob(os.path.join(plugins_path, "plugin*.py")))]
+        if sys.platform == "android":
+            # FIXME: android hack to load plugins from proper path
+            # TODO: move this in a separate module and/or use sat.conf to specify path
+            plugins_path = "/data/data/org.goffi.cagou.cagou/files/sat/plugins"
+            plugin_glob = "plugin*.pyo"
+        else:
+            import sat.plugins
+            plugins_path = os.path.dirname(sat.plugins.__file__)
+            plugin_glob = "plugin*.py"
+        plug_lst = [os.path.splitext(plugin)[0] for plugin in map(os.path.basename, glob(os.path.join(plugins_path, plugin_glob)))]
         plugins_to_import = {}  # plugins we still have to import
         for plug in plug_lst:
             plugin_path = 'sat.plugins.' + plug