ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/DAS/setup.py
Revision: 1.1
Committed: Tue Dec 15 03:21:24 2009 UTC (15 years, 4 months ago) by valya
Content type: text/x-python
Branch: MAIN
CVS Tags: V03_00_04, V03_00_03, V03_00_02, V03_00_01, V03_00_00, DAS_IMPL_CACHE_AND_MERGE, V02_00_10, V02_00_09, V02_00_08, V02_00_07
Log Message:
Standard python setup.py

File Contents

# User Rev Content
1 valya 1.1 #!/usr/bin/env python
2    
3     import sys
4     import os
5    
6     from ez_setup import use_setuptools
7     use_setuptools()
8     from setuptools import setup, find_packages, Feature
9     from distutils.cmd import Command
10     from distutils.command.build_ext import build_ext
11     from distutils.errors import CCompilerError
12     from distutils.errors import DistutilsPlatformError, DistutilsExecError
13     from distutils.core import Extension
14    
15     readme = "DAS stands for Data Aggregation Service"
16     version = "1.1.1" # need to define it somehow
17    
18     requirements = []
19     try:
20     import xml.etree.cElementTree
21     except ImportError:
22     try:
23     import celementtree
24     except ImportError:
25     requirements.append("celementtree")
26     try:
27     import pymongo
28     except ImportError:
29     requirements.append("pymongo")
30    
31     if sys.platform == 'win32' and sys.version_info > (2, 6):
32     # 2.6's distutils.msvc9compiler can raise an IOError when failing to
33     # find the compiler
34     build_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError,
35     IOError)
36     else:
37     build_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
38    
39    
40     class custom_build_ext(build_ext):
41     """Allow C extension building to fail.
42     The C extension speeds up DAS, but is not essential.
43     """
44    
45     warning_message = """
46     **************************************************************
47     WARNING: %s could not
48     be compiled. No C extensions are essential for DAS to run,
49     although they do result in significant speed improvements.
50    
51     %s
52     **************************************************************
53     """
54    
55     def run(self):
56     try:
57     build_ext.run(self)
58     except DistutilsPlatformError, e:
59     print e
60     print self.warning_message % ("Extension modules",
61     "There was an issue with your "
62     "platform configuration - see above.")
63    
64     def build_extension(self, ext):
65     try:
66     build_ext.build_extension(self, ext)
67     except build_errors:
68     print self.warning_message % ("The %s extension module" % ext.name,
69     "Above is the ouput showing how "
70     "the compilation failed.")
71    
72     c_ext = Feature(
73     "optional C extension",
74     standard=True,
75     ext_modules=[Extension('extensions.das_speed_utils',
76     include_dirs=['extensions'],
77     sources=['src/python/DAS/extensions/dict_handler.c'])])
78    
79     if "--no_ext" in sys.argv:
80     sys.argv = [x for x in sys.argv if x != "--no_ext"]
81     features = {}
82     else:
83     features = {"c-ext": c_ext}
84    
85     setup(
86     name="DAS",
87     version=version,
88     description="CMS Data Aggregation Service <https://twiki.cern.ch/twiki/bin/viewauth/CMS/DMWMDataAggregationService>",
89     long_description=readme,
90     author="Valentin Kuznetsov",
91     author_email="vkuznet@gmail.com",
92     url="https://twiki.cern.ch/twiki/bin/viewauth/CMS/DMWMDataAggregationService",
93     keywords=["CMS", "DAS", "WM"],
94     package_dir = {'DAS': 'src/python/DAS',
95     'core': 'src/python/DAS/core',
96     'extensions': 'src/python/DAS/extensions',
97     'services': 'src/python/DAS/services',
98     'tools': 'src/python/DAS/tools',
99     'utils': 'src/python/DAS/utils',
100     'web': 'src/python/DAS/web'},
101     packages = find_packages('src/python/DAS'),
102     install_requires=requirements,
103     features=features,
104     license="CMS experiment software",
105     # test_suite="nose.collector",
106     classifiers=[
107     "Development Status :: 3 - Production/Beta",
108     "Intended Audience :: Developers",
109     "License :: OSI Approved :: CMS/CERN Software License",
110     "Operating System :: MacOS :: MacOS X",
111     "Operating System :: Microsoft :: Windows",
112     "Operating System :: POSIX",
113     "Programming Language :: Python",
114     "Topic :: Database"],
115     cmdclass={"build_ext": custom_build_ext}
116     )