Ignore:
Timestamp:
08/12/06 14:23:51 (14 years ago)
Author:
spascoe
Message:

Moved test_home creation code into the package so that it can be run when
deployed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI03-DataExtractor/branches/repackaging/server/ndg/dx/server/MakeConfig.py

    r1841 r1845  
    77import os, shutil, pkg_resources 
    88 
    9 from ndg.utils.config import NDG_HOME 
    10  
    119def makeConfig(): 
    1210    """If the $NDG_HOME/dxs does not exist create it by copying the default 
    1311    from the egg. 
    1412    """ 
     13    from ndg.utils.config import NDG_HOME 
    1514 
    1615    if os.path.exists(os.path.join(NDG_HOME, 'dxs')): 
     
    2322    pkg_resources.cleanup_resources() 
    2423             
     24def makeTestHome(test_home, test_conf=None): 
     25    # Set NDG_HOME to be picked up by ndg.utils.config 
     26    os.environ['NDG_HOME'] = test_home 
     27     
     28    # At this point it is safe to import the configuration. 
     29    # get global configuration (this will read /etc/ndg.conf) 
     30    from ndg.utils.config import config 
     31     
     32    # parse selected test_conf 
     33    if test_conf: 
     34        config.read(test_conf) 
     35    else: 
     36        fp = pkg_resources.resource_stream('ndg.dx.server.test', 'server.conf') 
     37        config.readfp(fp) 
     38         
     39    # Set BASEDIR and create the dxs directory 
     40    config.set('ndg.dx.server', 'basedir', os.path.join(test_home, 'dxs')) 
     41    makeConfig() 
Note: See TracChangeset for help on using the changeset viewer.