Mercurial > libervia-backend
comparison src/core/constants.py @ 1003:52ec79aa5bbe
memory: fixes the method fixLocalDir for pid_dir and log_dir to use local_dir as default
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 30 Apr 2014 19:54:21 +0200 |
parents | eb3601ff73bc |
children | 191f440d11b4 |
comparison
equal
deleted
inserted
replaced
1002:291eb8216f6e | 1003:52ec79aa5bbe |
---|---|
15 # GNU Affero General Public License for more details. | 15 # GNU Affero General Public License for more details. |
16 | 16 |
17 # You should have received a copy of the GNU Affero General Public License | 17 # You should have received a copy of the GNU Affero General Public License |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 import os.path | 20 from os.path import expanduser, abspath |
21 try: | 21 try: |
22 import __pyjamas__ # do not import xdg when building Libervia | 22 import __pyjamas__ # do not import xdg when building Libervia |
23 BaseDirectory = None | 23 BaseDirectory = None |
24 except ImportError: | 24 except ImportError: |
25 from xdg import BaseDirectory | 25 from xdg import BaseDirectory |
28 class Const(object): | 28 class Const(object): |
29 | 29 |
30 ## Application ## | 30 ## Application ## |
31 APP_NAME = u'Salut à Toi' | 31 APP_NAME = u'Salut à Toi' |
32 APP_NAME_SHORT = u'SàT' | 32 APP_NAME_SHORT = u'SàT' |
33 APP_NAME_FILE = u'sat' | |
33 APP_NAME_FULL = u'%s (%s)' % (APP_NAME_SHORT, APP_NAME) | 34 APP_NAME_FULL = u'%s (%s)' % (APP_NAME_SHORT, APP_NAME) |
34 APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions | 35 APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions |
35 APP_URL = 'http://salut-a-toi.org' | 36 APP_URL = 'http://salut-a-toi.org' |
36 | 37 |
37 | 38 |
52 ## Configuration ## | 53 ## Configuration ## |
53 if BaseDirectory: # skipped when imported from Libervia browser_side | 54 if BaseDirectory: # skipped when imported from Libervia browser_side |
54 | 55 |
55 ## Configuration ## | 56 ## Configuration ## |
56 DEFAULT_CONFIG = { | 57 DEFAULT_CONFIG = { |
57 'media_dir': '/usr/share/sat/media', | 58 'media_dir': '/usr/share/' + APP_NAME_FILE + '/media', |
58 'pid_dir': '/tmp', | 59 'local_dir': BaseDirectory.save_data_path(APP_NAME_FILE), |
59 'log_dir': BaseDirectory.save_data_path('sat'), | 60 'pid_dir': '%(local_dir)s', |
61 'log_dir': '%(local_dir)s', | |
60 } | 62 } |
61 | 63 |
62 # XXX: tmp update code, will be removed in the future | |
63 # When you remove this, please add that in DEFAULT_CONFIG: | |
64 # 'local_dir': BaseDirectory.save_data_path('sat'), | |
65 # and also remove sat.memory.memory.Memory.__fixLocalDir | |
66 DEFAULT_LOCAL_DIR = BaseDirectory.save_data_path('sat') | |
67 | |
68 # List of the configuration filenames sorted by ascending priority | 64 # List of the configuration filenames sorted by ascending priority |
69 CONFIG_FILES = [(os.path.expanduser(path) + 'sat.conf') for path in | 65 CONFIG_FILES = [abspath(expanduser(path) + APP_NAME_FILE + '.conf') for path in |
70 ['/etc/', '~/', '~/.', '', '.'] + | 66 ['/etc/', '~/', '~/.', '', '.'] + |
71 ['%s/' % path for path in list(BaseDirectory.load_config_paths('sat'))] | 67 ['%s/' % path for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE))] |
72 ] | 68 ] |
73 | 69 |
74 | 70 |
75 ## Plugins ## | 71 ## Plugins ## |
76 # names of widely used plugins | 72 # names of widely used plugins |
87 LOG_OPT_COLORS = ('colors', 'true') | 83 LOG_OPT_COLORS = ('colors', 'true') |
88 LOG_OPT_LEVEL = ('level', 'info') | 84 LOG_OPT_LEVEL = ('level', 'info') |
89 | 85 |
90 | 86 |
91 ## Misc ## | 87 ## Misc ## |
92 SAVEFILE_DATABASE = "sat.db" | 88 SAVEFILE_DATABASE = APP_NAME_FILE + ".db" |
93 IQ_SET = '/iq[@type="set"]' | 89 IQ_SET = '/iq[@type="set"]' |
94 ENV_PREFIX = 'SAT_' # Prefix used for environment variables | 90 ENV_PREFIX = 'SAT_' # Prefix used for environment variables |
95 | 91 |
96 | 92 |
97 ## ANSI escape sequences ## | 93 ## ANSI escape sequences ## |