core(constants): added a constant for profile extension (PLUGIN_EXT):
this constant may be modified if needed, which is the case on Android (it's modified by Cagou service's main.py), so platform detection is not needed anymore in sat_main.py.
This commit is contained in:
parent
fa136a4998
commit
a37b57e7ad
2 changed files with 8 additions and 11 deletions
|
|
@ -35,11 +35,14 @@ class Const(object):
|
|||
APP_URL = u'http://salut-a-toi.org'
|
||||
|
||||
|
||||
# Main config ##
|
||||
## Runtime ##
|
||||
PLUGIN_EXT = "py"
|
||||
|
||||
## Main config ##
|
||||
DEFAULT_BRIDGE = 'dbus'
|
||||
|
||||
|
||||
# Protocol
|
||||
## Protocol ##
|
||||
XMPP_C2S_PORT = 5222
|
||||
XMPP_KEEP_ALIFE = 180
|
||||
XMPP_MAX_RETRIES = 2
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ from sat.tools import trigger
|
|||
from sat.tools import utils
|
||||
from sat.tools.common import dynamic_import
|
||||
from sat.stdui import ui_contact_list, ui_profile_manager
|
||||
import sat.plugins
|
||||
from glob import glob
|
||||
from uuid import uuid4
|
||||
import sys
|
||||
|
|
@ -154,15 +155,8 @@ class SAT(service.Service):
|
|||
|
||||
def _import_plugins(self):
|
||||
"""Import all plugins found in plugins directory"""
|
||||
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"
|
||||
plugins_path = os.path.dirname(sat.plugins.__file__)
|
||||
plugin_glob = "plugin*." + C.PLUGIN_EXT
|
||||
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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue