Mercurial > libervia-backend
comparison src/core/constants.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 | c96fe007ca41 |
comparison
equal
deleted
inserted
replaced
2088:c02f96756d5c | 2089:0931b5a6213c |
---|---|
130 NS_XHTML = 'http://www.w3.org/1999/xhtml' | 130 NS_XHTML = 'http://www.w3.org/1999/xhtml' |
131 | 131 |
132 | 132 |
133 ## Configuration ## | 133 ## Configuration ## |
134 if BaseDirectory: # skipped when xdg module is not available (should not happen in backend) | 134 if BaseDirectory: # skipped when xdg module is not available (should not happen in backend) |
135 | 135 if "org.goffi.cagou.cagou" in BaseDirectory.__file__: |
136 ## Configuration ## | 136 # FIXME: hack to make config read from the right location on Android |
137 DEFAULT_CONFIG = { | 137 # TODO: fix it in a more proper way |
138 'media_dir': '/usr/share/' + APP_NAME_FILE + '/media', | 138 BaseDirectory = None |
139 'local_dir': BaseDirectory.save_data_path(APP_NAME_FILE), | 139 DEFAULT_CONFIG = { |
140 'pid_dir': '%(local_dir)s', | 140 'local_dir': '/data/data/org.goffi.cagou.cagou/', |
141 'log_dir': '%(local_dir)s', | 141 'media_dir': '/data/data/org.goffi.cagou.cagou/files/media', |
142 } | 142 'pid_dir': '%(local_dir)s', |
143 | 143 'log_dir': '%(local_dir)s', |
144 # List of the configuration filenames sorted by ascending priority | 144 } |
145 CONFIG_FILES = [realpath(expanduser(path) + APP_NAME_FILE + '.conf') for path in | 145 CONFIG_FILES = ['/data/data/org.goffi.cagou.cagou/files/' + APP_NAME_FILE + '.conf'] |
146 ['/etc/', '~/', '~/.', '', '.'] + | 146 else: |
147 ['%s/' % path for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE))] | 147 |
148 ] | 148 ## Configuration ## |
149 DEFAULT_CONFIG = { | |
150 'media_dir': '/usr/share/' + APP_NAME_FILE + '/media', | |
151 'local_dir': BaseDirectory.save_data_path(APP_NAME_FILE), | |
152 'pid_dir': '%(local_dir)s', | |
153 'log_dir': '%(local_dir)s', | |
154 } | |
155 | |
156 # List of the configuration filenames sorted by ascending priority | |
157 CONFIG_FILES = [realpath(expanduser(path) + APP_NAME_FILE + '.conf') for path in | |
158 ['/etc/', '~/', '~/.', '', '.'] + | |
159 ['%s/' % path for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE))] | |
160 ] | |
149 | 161 |
150 | 162 |
151 ## Plugins ## | 163 ## Plugins ## |
152 | 164 |
153 # Types | 165 # Types |