Changeset 1845


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

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

Location:
TI03-DataExtractor/branches/repackaging/server
Files:
2 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() 
  • TI03-DataExtractor/branches/repackaging/server/setup.py

    r1843 r1845  
    3131    def run(self): 
    3232        import os, pkg_resources, shutil, ConfigParser 
     33        from ndg.dx.server.MakeConfig import makeTestHome 
    3334 
    3435        # Wipe clean self.test_home 
     
    3637            shutil.rmtree(self.test_home) 
    3738        os.mkdir(self.test_home) 
    38         # Set NDG_HOME to be picked up by ndg.utils.config 
    39         os.environ['NDG_HOME'] = self.test_home 
    4039 
    41         # At this point it is safe to import the configuration. 
    42         # get global configuration (this will read /etc/ndg.conf) 
    43         from ndg.utils.config import config 
    44         from ndg.dx.server.MakeConfig import makeConfig 
    45  
    46         # parse selected test_conf 
    47         if self.test_conf: 
    48             config.read(self.test_conf) 
    49         else: 
    50             fp = pkg_resources.resource_stream('ndg.dx.server.test', 'server.conf') 
    51             config.readfp(fp) 
    52              
    53         # Set BASEDIR and create the dxs directory 
    54         config.set('ndg.dx.server', 'basedir', os.path.join(self.test_home, 'dxs')) 
    55         makeConfig() 
     40        makeTestHome(self.test_home, self.test_conf) 
    5641 
    5742        # Run the tests 
Note: See TracChangeset for help on using the changeset viewer.