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.
This commit is contained in:
Goffi 2016-12-04 18:16:48 +01:00
commit 2618d48e7b

View file

@ -132,20 +132,32 @@ class Const(object):
## Configuration ##
if BaseDirectory: # skipped when xdg module is not available (should not happen in backend)
if "org.goffi.cagou.cagou" in BaseDirectory.__file__:
# FIXME: hack to make config read from the right location on Android
# TODO: fix it in a more proper way
BaseDirectory = None
DEFAULT_CONFIG = {
'local_dir': '/data/data/org.goffi.cagou.cagou/',
'media_dir': '/data/data/org.goffi.cagou.cagou/files/media',
'pid_dir': '%(local_dir)s',
'log_dir': '%(local_dir)s',
}
CONFIG_FILES = ['/data/data/org.goffi.cagou.cagou/files/' + APP_NAME_FILE + '.conf']
else:
## Configuration ##
DEFAULT_CONFIG = {
'media_dir': '/usr/share/' + APP_NAME_FILE + '/media',
'local_dir': BaseDirectory.save_data_path(APP_NAME_FILE),
'pid_dir': '%(local_dir)s',
'log_dir': '%(local_dir)s',
}
## Configuration ##
DEFAULT_CONFIG = {
'media_dir': '/usr/share/' + APP_NAME_FILE + '/media',
'local_dir': BaseDirectory.save_data_path(APP_NAME_FILE),
'pid_dir': '%(local_dir)s',
'log_dir': '%(local_dir)s',
}
# List of the configuration filenames sorted by ascending priority
CONFIG_FILES = [realpath(expanduser(path) + APP_NAME_FILE + '.conf') for path in
['/etc/', '~/', '~/.', '', '.'] +
['%s/' % path for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE))]
]
# List of the configuration filenames sorted by ascending priority
CONFIG_FILES = [realpath(expanduser(path) + APP_NAME_FILE + '.conf') for path in
['/etc/', '~/', '~/.', '', '.'] +
['%s/' % path for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE))]
]
## Plugins ##