cwconfig.py
branchstable
changeset 4889 b3e2de8f53cd
parent 4624 1b46d5ece0d5
child 4899 c666d265fb95
child 4936 a4b772a0d801
equal deleted inserted replaced
4888:fc8b4d861f34 4889:b3e2de8f53cd
   215     # debug mode
   215     # debug mode
   216     debugmode = False
   216     debugmode = False
   217 
   217 
   218     if os.environ.get('APYCOT_ROOT'):
   218     if os.environ.get('APYCOT_ROOT'):
   219         mode = 'test'
   219         mode = 'test'
   220         if CWDEV:
   220         # allow to test cubes within apycot using cubicweb not installed by
       
   221         # apycot
       
   222         if __file__.startswith(os.environ['APYCOT_ROOT']):
   221             CUBES_DIR = '%(APYCOT_ROOT)s/local/share/cubicweb/cubes/' % os.environ
   223             CUBES_DIR = '%(APYCOT_ROOT)s/local/share/cubicweb/cubes/' % os.environ
   222             # create __init__ file
   224             # create __init__ file
   223             file(join(CUBES_DIR, '__init__.py'), 'w').close()
   225             file(join(CUBES_DIR, '__init__.py'), 'w').close()
   224         else:
   226         else:
   225             CUBES_DIR = '/usr/share/cubicweb/cubes/'
   227             CUBES_DIR = '/usr/share/cubicweb/cubes/'
   636 
   638 
   637 class CubicWebConfiguration(CubicWebNoAppConfiguration):
   639 class CubicWebConfiguration(CubicWebNoAppConfiguration):
   638     """base class for cubicweb server and web configurations"""
   640     """base class for cubicweb server and web configurations"""
   639 
   641 
   640     INSTANCES_DATA_DIR = None
   642     INSTANCES_DATA_DIR = None
   641     if CubicWebNoAppConfiguration.mode == 'test':
   643     if os.environ.get('APYCOT_ROOT'):
   642         root = os.environ['APYCOT_ROOT']
   644         root = os.environ['APYCOT_ROOT']
   643         REGISTRY_DIR = '%s/etc/cubicweb.d/' % root
   645         REGISTRY_DIR = '%s/etc/cubicweb.d/' % root
       
   646         if not exists(REGISTRY_DIR):
       
   647             os.makedirs(REGISTRY_DIR)
   644         RUNTIME_DIR = tempfile.gettempdir()
   648         RUNTIME_DIR = tempfile.gettempdir()
   645         if CWDEV:
   649         # allow to test cubes within apycot using cubicweb not installed by
       
   650         # apycot
       
   651         if __file__.startswith(os.environ['APYCOT_ROOT']):
   646             MIGRATION_DIR = '%s/local/share/cubicweb/migration/' % root
   652             MIGRATION_DIR = '%s/local/share/cubicweb/migration/' % root
   647         else:
   653         else:
   648             MIGRATION_DIR = '/usr/share/cubicweb/migration/'
   654             MIGRATION_DIR = '/usr/share/cubicweb/migration/'
   649         if not exists(REGISTRY_DIR):
       
   650             os.makedirs(REGISTRY_DIR)
       
   651     else:
   655     else:
   652         if CubicWebNoAppConfiguration.mode == 'user':
   656         if CubicWebNoAppConfiguration.mode == 'user':
   653             REGISTRY_DIR = expanduser('~/etc/cubicweb.d/')
   657             REGISTRY_DIR = expanduser('~/etc/cubicweb.d/')
   654             RUNTIME_DIR = tempfile.gettempdir()
   658             RUNTIME_DIR = tempfile.gettempdir()
   655             INSTANCES_DATA_DIR = REGISTRY_DIR
   659             INSTANCES_DATA_DIR = REGISTRY_DIR