File: setup.py

package info (click to toggle)
python-scipy 0.6.0-12
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 32,016 kB
  • ctags: 46,675
  • sloc: cpp: 124,854; ansic: 110,614; python: 108,664; fortran: 76,260; objc: 424; makefile: 384; sh: 10
file content (50 lines) | stat: -rwxr-xr-x 1,689 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
import os
from numpy.distutils.system_info import system_info, dict_append, \
    NotFoundError

class NetCDFNotFound(NotFoundError):
    """
    NetCDF (http://www.unidata.ucar.edu/software/netcdf/) not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [netcdf]) or by setting
    the NETCDF variable.
    """

class netcdf_info(system_info):
    section = 'netcdf'
    dir_env_var = 'NETCDF'
    notfounderror = NetCDFNotFound

    def __init__(self, *args, **kw):
        system_info.__init__(self, *args, **kw)
        self.cp.defaults()['libraries'] = 'netcdf'

    def calc_info(self):
        info = self.calc_libraries_info()
        include_dirs = self.get_include_dirs()
        inc_dir = None
        for d in include_dirs:
            if self.combine_paths(d, 'netcdf.h'):
                inc_dir = d
                break
        if inc_dir is not None:
            dict_append(info, include_dirs=[inc_dir])
        self.set_info(**info)

def configuration(parent_package='',top_path=None):
    from numpy.distutils.misc_util import Configuration
    config = Configuration('netcdf',parent_package,top_path)
    netcdf = netcdf_info().get_info()
    config.add_extension('_netcdf',
                         sources = ['_netcdf.c'],
                         depends = ['_netcdf.h'],
                         extra_info = netcdf)
    config.add_data_files('demomodule.c','Scientific_LICENSE',
                          'README')
    return config

if __name__ == "__main__":
    from numpy.distutils.core import setup
    config = configuration(top_path='').todict() 
    setup(**config)