cwconfig.py
branch3.5
changeset 3071 6ad4e6d4df86
parent 3059 1be8bf42bc5d
child 3115 29262ba01464
equal deleted inserted replaced
3052:73b1d3746193 3071:6ad4e6d4df86
   132     'yn':     'Boolean',
   132     'yn':     'Boolean',
   133     'int':    'Int',
   133     'int':    'Int',
   134     'float' : 'Float',
   134     'float' : 'Float',
   135     }
   135     }
   136 
   136 
       
   137 _forced_mode = os.environ.get('CW_MODE')
       
   138 assert _forced_mode in (None, 'system', 'user')
       
   139 
   137 class CubicWebNoAppConfiguration(ConfigurationMixIn):
   140 class CubicWebNoAppConfiguration(ConfigurationMixIn):
   138     """base class for cubicweb configuration without a specific instance directory
   141     """base class for cubicweb configuration without a specific instance directory
   139     """
   142     """
   140     __metaclass__ = metaconfiguration
   143     __metaclass__ = metaconfiguration
   141     # to set in concrete configuration
   144     # to set in concrete configuration
   148     if os.environ.get('APYCOT_ROOT'):
   151     if os.environ.get('APYCOT_ROOT'):
   149         mode = 'test'
   152         mode = 'test'
   150         CUBES_DIR = '%(APYCOT_ROOT)s/local/share/cubicweb/cubes/' % os.environ
   153         CUBES_DIR = '%(APYCOT_ROOT)s/local/share/cubicweb/cubes/' % os.environ
   151         # create __init__ file
   154         # create __init__ file
   152         file(join(CUBES_DIR, '__init__.py'), 'w').close()
   155         file(join(CUBES_DIR, '__init__.py'), 'w').close()
   153     elif exists(join(CW_SOFTWARE_ROOT, '.hg')) or os.environ.get('CW_MODE') == 'user':
   156     elif (exists(join(CW_SOFTWARE_ROOT, '.hg')) and _forced_mode != 'system') or _forced_mode == 'user':
   154         mode = 'dev'
   157         mode = 'dev'
   155         CUBES_DIR = abspath(normpath(join(CW_SOFTWARE_ROOT, '../cubes')))
   158         CUBES_DIR = abspath(normpath(join(CW_SOFTWARE_ROOT, '../cubes')))
   156     else:
   159     else:
   157         mode = 'installed'
   160         mode = 'installed'
   158         CUBES_DIR = '/usr/share/cubicweb/cubes/'
   161         CUBES_DIR = '/usr/share/cubicweb/cubes/'