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 (53 lines) | stat: -rw-r--r-- 1,693 bytes parent folder | download
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
51
52
53
__version__ = '1.0'
__revision__ = "$Revision: 37 $"
__date__     = '$Date: 2006-12-08 14:30:29 -0500 (Fri, 08 Dec 2006) $'

import os, sys
from os.path import join

def configuration(parent_package='',top_path=None):
    from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
    nxheader = join(get_numpy_include_dirs()[0],'numpy',)

    famedir = os.getenv('FAME')
    if famedir is None:
        raise EnvironmentError("FAME environment variable not found")

    if sys.platform == 'win32': msvc_flags()

    fameheader = famedir
    confgr = Configuration(parent_package=parent_package,top_path=top_path)

    sources = join('src', 'cfame.c')
    libraries = "chli"
    library_dirs = [famedir, join(famedir, "demo/hli")]
    confgr.add_extension('cfame',
                         sources=[sources],
                         include_dirs=[nxheader, fameheader, library_dirs],
                         libraries = [libraries],
                         library_dirs = [library_dirs]
                         )
    return confgr
    
def msvc_flags():
    """/DWIN32 flag is required on windows for compiling FAME
C-hli code"""

    from distutils.msvccompiler import MSVCCompiler

    # remember old initialize
    old_MSVCCompiler_initialize = MSVCCompiler.initialize

    def fame_msvccompiler_initialize(self, *args, **kws):
         apply(old_MSVCCompiler_initialize, (self,) + args, kws)
         self.compile_options.extend(['/DWIN32'])

    # "Install" new initialize
    MSVCCompiler.initialize = fame_msvccompiler_initialize

if __name__ == "__main__":

    from numpy.distutils.core import setup
    config = configuration().todict() 
    setup(**config)