protect mysql tests using mysql_enabled()
[pygr.git] / setup.py
blobc6ba116d59b04fd247b2ac6e9cd6f0f11763dcc0
1 #!/usr/bin/env python
2 """
3 Pygr
4 ====
6 Pygr is an open source software project used to develop graph database
7 interfaces for the popular Python language, with a strong emphasis
8 on bioinformatics applications ranging from genome-wide analysis of
9 alternative splicing patterns, to comparative genomics queries of
10 multi-genome alignment data.
11 """
13 import os, sys
15 try:
16 from setuptools import setup, Extension
17 except ImportError:
18 print 'Setuptools not imported, falling back to distutils'
19 from distutils.core import setup, Extension
21 def error(msg):
22 "Fatal errors"
23 print( '*** error %s' % msg )
24 sys.exit()
26 import pygr
28 PYGR_NAME = "pygr"
29 PYGR_VERSION = pygr.__version__
31 if sys.version_info < (2, 3):
32 error( 'pygr requires python 2.3 or higher' )
34 CLASSIFIERS = """
35 Development Status :: 5 - Production/Stable
36 Operating System :: MacOS :: MacOS X
37 Operating System :: Microsoft :: Windows :: Windows NT/2000
38 Operating System :: OS Independent
39 Operating System :: POSIX
40 Operating System :: POSIX :: Linux
41 Operating System :: Unix
42 Programming Language :: Python
43 Topic :: Scientific/Engineering
44 Topic :: Scientific/Engineering :: Bio-Informatics
45 """
47 # split into lines and filter empty ones
48 CLASSIFIERS = filter(None, CLASSIFIERS.splitlines() )
50 # Setuptools should handle all this automatically
51 if sys.modules.has_key('setuptools'):
52 try:
53 import pkg_resources
54 pkg_resources.require('Pyrex>=0.9.8')
55 ext = 'pyx'
56 except pkg_resources.DistributionNotFound:
57 ext = 'c'
58 cmdclass = { }
59 else:
60 # if pyrex is not present try compiling the C files
61 try:
62 from Pyrex.Compiler.Version import version as PYREX_VERSION
63 from Pyrex.Distutils import build_ext
64 if PYREX_VERSION < "0.9.8":
65 error ( "pyrex version >=0.9.8 required, found %s" % PYREX_VERSION )
66 ext = 'pyx'
67 cmdclass = { 'build_ext': build_ext }
68 except ImportError, exc:
69 ext = 'c'
70 cmdclass = {}
72 # extension sources
73 seqfmt_src = [ os.path.join('pygr', 'seqfmt.%s' % ext) ]
74 cdict_src = [ os.path.join('pygr', 'cgraph.c'),
75 os.path.join('pygr', 'cdict.%s' % ext) ]
76 nested_src = [ os.path.join('pygr', 'intervaldb.c'),
77 os.path.join('pygr', 'cnestedlist.%s' % ext),
78 os.path.join('pygr', 'apps', 'maf2nclist.c') ]
80 def main():
81 setup(
82 name = PYGR_NAME ,
83 version= PYGR_VERSION,
84 description = 'Pygr, a Python graph-database toolkit oriented primarily on bioinformatics applications',
85 long_description = __doc__,
86 author = "Christopher Lee",
87 author_email='leec@chem.ucla.edu',
88 url = 'http://code.google.com/p/pygr/',
89 license = 'New BSD License',
90 classifiers = CLASSIFIERS,
92 packages = [ 'pygr', 'pygr.apps' ],
94 ext_modules = [
95 Extension( 'pygr.seqfmt', seqfmt_src ),
96 Extension( 'pygr.cdict', cdict_src ),
97 Extension( 'pygr.cnestedlist', nested_src),
100 cmdclass = cmdclass,
103 if __name__ == '__main__':
104 main()