Package SloppyCell :: Module setup
[hide private]

Source Code for Module SloppyCell.setup

 1  # This gets f2py_signatures installed in the correct place. See  
 2  # http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb 
 3  from distutils.command.install import INSTALL_SCHEMES 
 4  for scheme in INSTALL_SCHEMES.values(): 
 5      scheme['data'] = scheme['purelib']  
 6   
 7  # Importing these adds a 'bdist_mpkg' option that allows building binary packages on OS X. 
 8  try: 
 9      import setuptools 
10      import bdist_mpkg 
11  except ImportError: 
12      pass 
13   
14   
15  import scipy 
16  if hasattr(scipy, 'Numeric'): 
17      # Using old scipy 
18      import scipy_distutils.core as core 
19      data_files = [('SloppyCell/ReactionNetworks',  
20                     ['ReactionNetworks/f2py_signatures.pyf', 
21                      'ReactionNetworks/mtrand.h', 
22                      'ReactionNetworks/mtrand.c'])] 
23  else: 
24      # Using new scipy 
25      import numpy.distutils.core as core 
26   
27      from numpy.distutils.misc_util import Configuration 
28      # Annoyingly, distutils doesn't have an option to recursively include 
29      # a data directory. We can use numpy's Configuration class, however, 
30      # to do the recursion for us. 
31      config = Configuration('SloppyCell') 
32      config.add_data_files('ReactionNetworks/f2py_signatures.pyf', 
33                            'ReactionNetworks/mtrand.h', 
34                            'ReactionNetworks/mtrand.c') 
35      config.add_data_dir('Doc') 
36      config.add_data_dir('ddaskr') 
37      config.add_data_dir('Example') 
38      data_files = config.todict()['data_files'] 
39   
40  # This is a kludge so that sdist works on AFS systems. 
41  # AFS doesn't allow hard-linking across directories, but if we're on linux 
42  #  we still have a os.link function (which is all distutils check for). 
43  # If we delete os.link, sdist will copy rather than link. 
44  # See http://mail.python.org/pipermail/distutils-sig/2002-October/002990.html 
45  #  for more detail, and a patch that apparently never got applied to trunk 
46  #  distutils 
47  # I don't know why this kludge wasn't needed for Python 2.3 
48  import os 
49  if hasattr(os, 'link'): 
50      del os.link 
51   
52  # These packages include some BLAS functions in them. Strangely, at least 
53  #  on CCMR, it seems (very slightly), faster to use the included ones rather 
54  #  than linking against LAPACK. 
55  daskr = core.Extension(name = 'SloppyCell._daskr', 
56                         sources = ['daskr.pyf', 'ddaskr/ddaskr.f',  
57                                    'ddaskr/daux.f', 'ddaskr/dlinpk.f']) 
58   
59  misc_c = core.Extension(name = 'SloppyCell.misc_c', 
60                          sources = ['misc_c.c', 'misc_c.pyf']) 
61   
62  core.setup(name='SloppyCell', 
63             version='CVS', 
64             author='Ryan Gutenkunst', 
65             author_email='rng7@cornell.edu', 
66             url='http://sloppycell.sourceforge.net', 
67             packages=['SloppyCell',  
68                       'SloppyCell.ReactionNetworks',  
69                       'SloppyCell.Testing', 
70                       'SloppyCell.ExprManip', 
71                       'SloppyCell.Vandermonde', 
72                       ], 
73             package_dir={'SloppyCell': ''}, 
74             data_files=data_files, 
75   
76             ext_modules = [daskr, misc_c] 
77             ) 
78