source: TI03-DataExtractor/branches/repackaging/server/setup.py @ 1843

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI03-DataExtractor/branches/repackaging/server/setup.py@1843
Revision 1843, 3.1 KB checked in by spascoe, 14 years ago (diff)

Moved import statements out of init.py.

RevLine 
[1776]1"""
2ndg.dx.server setup script.
3
4@author: Stephen Pascoe
5"""
6
7import ez_setup; ez_setup.use_setuptools()
8
9from setuptools import setup, find_packages
10
[1840]11from setuptools.command.test import test
12class ndgTest(test):
13    description = "create a temporary NDG environment before testing"
14
15    user_options = [
16        ('test-home', 'h', "directory to create the NDG environment"),
17        ('test-conf', 'c', "configuration file to base NDG_HOME/ndg.conf on"
18                          " (default: egg:ndg.dx.server.test.server.conf)"),
19        ] + test.user_options
20
21    def initialize_options(self):
22        test.initialize_options(self)
23        self.test_home = None
24        self.test_conf = None
25
26    def finalize_options(self):
[1843]27        test.finalize_options(self)
[1840]28        if not self.test_home:
29            self.test_home = './test_ndg_home'
30
31    def run(self):
32        import os, pkg_resources, shutil, ConfigParser
33
34        # Wipe clean self.test_home
35        if os.path.exists(self.test_home):
36            shutil.rmtree(self.test_home)
[1843]37        os.mkdir(self.test_home)
[1840]38        # Set NDG_HOME to be picked up by ndg.utils.config
39        os.environ['NDG_HOME'] = self.test_home
40
[1843]41        # At this point it is safe to import the configuration.
[1840]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()
56
57        # Run the tests
58        return test.run(self)
59
[1843]60
[1776]61setup(
62    name = 'ndg_dx_server',
63    version = '0.3.5a1',
64    description = 'Python Data Extractor Server',
65    author = 'Ag Stephens',
66    author_email = 'a.stephens@rl.ac.uk',
67    url = 'http://ndg.nerc.ac.uk/DataExtractor',
68    license = """Copyright (C) 2004 CCLRC & NERC( Natural Environment Research Council ).
69This software may be distributed under the terms of the
70Q Public License, version 1.0 or later. http://ndg.nerc.ac.uk/public_docs/QP""",
71
[1841]72    packages = find_packages(),
[1776]73    namespace_packages = ['ndg', 'ndg.dx'],
74
[1813]75    install_requires = ['ZSI==2.0rc3', 'cdat_lite',
[1776]76                        'ndg_utils'],
77    entry_points = '''
78    [console_scripts]
79    addDatasetGroup = ndg.dx.server.scripts.addDatasetGroup:main
80    addDataset = ndg.dx.server.scripts.addDataset:main
81    addWholeCatalogue = ndg.dx.server.scripts.addWholeCatalogue:main
82    cleanOutDatasetXMLFile = ndg.dx.server.scripts.cleanOutDatasetXMLFile:main
83    DXWSInterface = ndg.dx.server.scripts.DXWSInterface:main
84    fixSession = ndg.dx.server.scripts.fixSession:main
85    removeDataset = ndg.dx.server.scripts.removeDataset:main
86    showSession = ndg.dx.server.scripts.showSession:main
87    ''',
88
89    include_package_data = True,
[1815]90
[1817]91    test_suite = 'ndg.dx.server.test.test_suite',
[1840]92    cmdclass = {'test': ndgTest},
[1776]93    )
94   
Note: See TracBrowser for help on using the repository browser.