Mercurial > libervia-web
comparison bin/libervia @ 1216:b2d067339de3
python 3 port:
/!\ Python 3.6+ is now needed to use libervia
/!\ instability may occur and features may not be working anymore, this will improve with time
/!\ TxJSONRPC dependency has been removed
The same procedure as in backend has been applied (check backend commit ab2696e34d29 logs
for details). Removed now deprecated code (Pyjamas compiled browser part, legacy blog,
JSON RPC related code).
Adapted code to work without `html` and `themes` dirs.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 13 Aug 2019 19:12:31 +0200 |
parents | 28e3eb3bb217 |
children | 63f7a2bd1d4a |
comparison
equal
deleted
inserted
replaced
1215:f14ab8a25e8b | 1216:b2d067339de3 |
---|---|
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 DEBUG="" | 3 DEBUG="" |
4 DAEMON="" | 4 DAEMON="" |
5 PYTHON="python2" | 5 PYTHON="python3" |
6 TWISTD="$(which twistd)" | 6 TWISTD="$(which twistd)" |
7 | 7 |
8 kill_process() { | 8 kill_process() { |
9 # $1 is the file containing the PID to kill, $2 is the process name | 9 # $1 is the file containing the PID to kill, $2 is the process name |
10 if [ -f $1 ]; then | 10 if [ -f $1 ]; then |
23 | 23 |
24 #We use python to parse config files | 24 #We use python to parse config files |
25 eval `"$PYTHON" << PYTHONEND | 25 eval `"$PYTHON" << PYTHONEND |
26 from libervia.server.constants import Const as C | 26 from libervia.server.constants import Const as C |
27 from sat.memory.memory import fixLocalDir | 27 from sat.memory.memory import fixLocalDir |
28 from ConfigParser import SafeConfigParser | 28 from configparser import ConfigParser |
29 from os.path import expanduser, join | 29 from os.path import expanduser, join |
30 import sys | 30 import sys |
31 import codecs | |
32 import locale | |
33 | |
34 sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout) | |
35 | 31 |
36 fixLocalDir() # XXX: tmp update code, will be removed in the future | 32 fixLocalDir() # XXX: tmp update code, will be removed in the future |
37 | 33 |
38 config = SafeConfigParser(defaults=C.DEFAULT_CONFIG) | 34 config = ConfigParser(defaults=C.DEFAULT_CONFIG) |
39 try: | 35 try: |
40 config.read(C.CONFIG_FILES) | 36 config.read(C.CONFIG_FILES) |
41 except: | 37 except: |
42 print ("echo \"/!\\ Can't read main config ! Please check the syntax\";") | 38 print ("echo \"/!\\ Can't read main config ! Please check the syntax\";") |
43 print ("exit 1") | 39 print ("exit 1") |
46 env=[] | 42 env=[] |
47 env.append("PID_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'pid_dir')),'')) | 43 env.append("PID_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'pid_dir')),'')) |
48 env.append("LOG_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'log_dir')),'')) | 44 env.append("LOG_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'log_dir')),'')) |
49 env.append("APP_NAME='%s'" % C.APP_NAME) | 45 env.append("APP_NAME='%s'" % C.APP_NAME) |
50 env.append("APP_NAME_FILE='%s'" % C.APP_NAME_FILE) | 46 env.append("APP_NAME_FILE='%s'" % C.APP_NAME_FILE) |
51 print ";".join(env) | 47 print (";".join(env)) |
52 PYTHONEND | 48 PYTHONEND |
53 ` | 49 ` |
54 APP_NAME="$APP_NAME" | 50 APP_NAME="$APP_NAME" |
55 PID_FILE="$PID_DIR$APP_NAME_FILE.pid" | 51 PID_FILE="$PID_DIR$APP_NAME_FILE.pid" |
56 LOG_FILE="$LOG_DIR$APP_NAME_FILE.log" | 52 LOG_FILE="$LOG_DIR$APP_NAME_FILE.log" |