comparison src/sat.sh @ 1114:7293233970ab

misc: stdout encoding management in python part of sat.sh
author Goffi <goffi@goffi.org>
date Wed, 20 Aug 2014 23:42:58 +0200
parents 52ec79aa5bbe
children b56374a1f6d6
comparison
equal deleted inserted replaced
1113:edd3fc4b4aaf 1114:7293233970ab
24 from sat.core.constants import Const as C 24 from sat.core.constants import Const as C
25 from sat.memory.memory import fixLocalDir 25 from sat.memory.memory import fixLocalDir
26 from ConfigParser import SafeConfigParser 26 from ConfigParser import SafeConfigParser
27 from os.path import expanduser, join 27 from os.path import expanduser, join
28 import sys 28 import sys
29 import codecs
30 import locale
31
32 sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
29 33
30 fixLocalDir() # XXX: tmp update code, will be removed in the future 34 fixLocalDir() # XXX: tmp update code, will be removed in the future
31 35
32 config = SafeConfigParser(defaults=C.DEFAULT_CONFIG) 36 config = SafeConfigParser(defaults=C.DEFAULT_CONFIG)
33 try: 37 try:
39 43
40 env=[] 44 env=[]
41 env.append("PID_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'pid_dir')),'')) 45 env.append("PID_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'pid_dir')),''))
42 env.append("LOG_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'log_dir')),'')) 46 env.append("LOG_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'log_dir')),''))
43 47
48 env.append("APP_NAME='%s'" % C.APP_NAME)
44 env.append("APP_NAME_FILE='%s'" % C.APP_NAME_FILE) 49 env.append("APP_NAME_FILE='%s'" % C.APP_NAME_FILE)
45 print ";".join(env) 50 print ";".join(env)
46 PYTHONEND 51 PYTHONEND
47 ` 52 `
48 APP_NAME="Salut à Toi" # FIXME: the import from Python constants fails because of the à 53 APP_NAME="$APP_NAME"
49 PID_FILE="$PID_DIR$APP_NAME_FILE.pid" 54 PID_FILE="$PID_DIR$APP_NAME_FILE.pid"
50 LOG_FILE="$LOG_DIR$APP_NAME_FILE.log" 55 LOG_FILE="$LOG_DIR$APP_NAME_FILE.log"
51 56
52 # if there is one argument which is "stop", then we kill SàT 57 # if there is one argument which is "stop", then we kill SàT
53 if [ $# -eq 1 ];then 58 if [ $# -eq 1 ];then