comparison 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
comparison
equal deleted inserted replaced
2088:c02f96756d5c 2089:0931b5a6213c
148 log.info(_("Memory initialised")) 148 log.info(_("Memory initialised"))
149 self._import_plugins() 149 self._import_plugins()
150 ui_contact_list.ContactList(self) 150 ui_contact_list.ContactList(self)
151 ui_profile_manager.ProfileManager(self) 151 ui_profile_manager.ProfileManager(self)
152 self.initialised.callback(None) 152 self.initialised.callback(None)
153 log.info(_("Backend is ready")) 153 log.info(_(u"Backend is ready"))
154 154
155 def _import_plugins(self): 155 def _import_plugins(self):
156 """Import all plugins found in plugins directory""" 156 """Import all plugins found in plugins directory"""
157 import sat.plugins 157 if sys.platform == "android":
158 plugins_path = os.path.dirname(sat.plugins.__file__) 158 # FIXME: android hack to load plugins from proper path
159 plug_lst = [os.path.splitext(plugin)[0] for plugin in map(os.path.basename, glob(os.path.join(plugins_path, "plugin*.py")))] 159 # TODO: move this in a separate module and/or use sat.conf to specify path
160 plugins_path = "/data/data/org.goffi.cagou.cagou/files/sat/plugins"
161 plugin_glob = "plugin*.pyo"
162 else:
163 import sat.plugins
164 plugins_path = os.path.dirname(sat.plugins.__file__)
165 plugin_glob = "plugin*.py"
166 plug_lst = [os.path.splitext(plugin)[0] for plugin in map(os.path.basename, glob(os.path.join(plugins_path, plugin_glob)))]
160 plugins_to_import = {} # plugins we still have to import 167 plugins_to_import = {} # plugins we still have to import
161 for plug in plug_lst: 168 for plug in plug_lst:
162 plugin_path = 'sat.plugins.' + plug 169 plugin_path = 'sat.plugins.' + plug
163 try: 170 try:
164 __import__(plugin_path) 171 __import__(plugin_path)