source: TI03-DataExtractor/branches/repackaging/server/ndg/dx/server/MakeConfig.py @ 1841

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI03-DataExtractor/branches/repackaging/server/ndg/dx/server/MakeConfig.py@1841
Revision 1841, 640 bytes checked in by spascoe, 14 years ago (diff)

Moved lib/ndg to ndg.

RevLine 
[1840]1"""
2Set up the DX server directory structure inside $NDG_HOME.
3
4@author: Stephen Pascoe
5"""
6
7import os, shutil, pkg_resources
8
9from ndg.utils.config import NDG_HOME
10
11def makeConfig():
12    """If the $NDG_HOME/dxs does not exist create it by copying the default
13    from the egg.
14    """
15
16    if os.path.exists(os.path.join(NDG_HOME, 'dxs')):
17        return
18
19    # Get the dxs configuration directory
20    dxsPath = pkg_resources.resource_filename('ndg.dx.server', 'dxs')
21    shutil.copytree(dxsPath, os.path.join(NDG_HOME, 'dxs'))
22    # Clean-up dxsPath if it's been extracted to the cache.
23    pkg_resources.cleanup_resources()
24           
Note: See TracBrowser for help on using the repository browser.