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:
parent
9ce91cf534
commit
2618d48e7b
1 changed files with 81 additions and 24 deletions
|
|
@ -47,7 +47,11 @@ class ConfigureBasic(log.ConfigureBase):
|
|||
super(ConfigureBasic, self).configureColors(colors, force_colors, levels_taints_dict)
|
||||
if colors:
|
||||
import sys
|
||||
if force_colors or sys.stdout.isatty(): # FIXME: isatty should be tested on each handler, not globaly
|
||||
try:
|
||||
isatty = sys.stdout.isatty()
|
||||
except AttributeError:
|
||||
isatty = False
|
||||
if force_colors or isatty: # FIXME: isatty should be tested on each handler, not globaly
|
||||
# we need colors
|
||||
log.Logger.post_treat = lambda logger, level, message: self.ansiColors(level, message)
|
||||
elif force_colors:
|
||||
|
|
@ -262,6 +266,7 @@ class ConfigureStandard(ConfigureBasic):
|
|||
def configureFormat(self, fmt):
|
||||
super(ConfigureStandard, self).configureFormat(fmt)
|
||||
import logging
|
||||
import sys
|
||||
|
||||
class SatFormatter(logging.Formatter):
|
||||
u"""Formatter which manage SàT specificities"""
|
||||
|
|
@ -287,7 +292,12 @@ class ConfigureStandard(ConfigureBasic):
|
|||
s = super(SatFormatter, self).format(record)
|
||||
if do_color:
|
||||
s = ConfigureStandard.ansiColors(record.levelname, s)
|
||||
return s
|
||||
if sys.platform == "android":
|
||||
# FIXME: dirty hack to workaround android encoding issue on log
|
||||
# need to be fixed properly
|
||||
return s.encode('ascii', 'ignore')
|
||||
else:
|
||||
return s
|
||||
|
||||
self.formatterClass = SatFormatter
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue