File: setup.py

package info (click to toggle)
pywavelets 0.1.7~svn97-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 2,408 kB
  • ctags: 1,492
  • sloc: ansic: 3,375; python: 1,910; makefile: 44
file content (91 lines) | stat: -rw-r--r-- 2,636 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env python
#-*- coding: utf-8 -*-

from distutils.core import setup
from distutils.extension import Extension
import glob, os, os.path
import util.templating

if os.path.exists('MANIFEST'):
    os.remove('MANIFEST')

compiler = "cython" # "pyrex"
try:
    if compiler == "pyrex":
        from Pyrex.Distutils import build_ext
        has_pyrex = True
    elif compiler == "cython":
        from Cython.Distutils import build_ext
        has_pyrex = True
    else:
        raise ValueError("Invalid compiler '%s'." % compiler)
except ImportError:
    has_pyrex = False

if has_pyrex:
    source_ext = '.pyx'
    cmdclass    = {'build_ext': build_ext}
else:
    source_ext = '.c'
    cmdclass    = {}

# gather the release details
release = {}
execfile(os.path.join(os.path.dirname(__file__), 'pywt','release_details.py'), {}, release)

# tune the C compiler settings
extra_compile_args = ['-Wall', '-finline-limit=1', '-O2']
#extra_compile_args += ['-march=pentium4',  '-mtune=pentium4']
#extra_compile_args += ['-Wno-long-long', '-Wno-uninitialized', '-Wno-unused']

macros = [('PY_EXTENSION', None),
          #('OPT_UNROLL2', None), # enable some manual unroll loop optimizations
          #('OPT_UNROLL4', None)  # enable more manual unroll loop optimizations
         ]

dwt = Extension("pywt._pywt",
        sources = [(n + source_ext) for n in ['src/_pywt']] + ["src/common.c", "src/convolution.c", "src/wavelets.c", "src/wt.c"], 
        include_dirs = ['src'],
        library_dirs = [],
        runtime_library_dirs = [],
        libraries = [],
        define_macros = macros,
        extra_compile_args = extra_compile_args,
		extra_link_args = [],
		export_symbols = [],
)
 
ext_modules = [dwt]
packages =  ['pywt']
package_dir = {'pywt':'pywt'}

    
def do_setup(**extra_kwds):
    util.templating.expand_files('src/*.template', True)

    setup(
        name = release["name"],
        version = release["version"],
        description = release["description"],
        long_description = release["long_description"],
        author = release["author"],
        author_email = release["author_email"], 
        url = release["url"],
        download_url = release["download_url"],
        license = release["license"],
        keywords = release["keywords"],
        platforms = release["platforms"],
        classifiers = release["classifiers"],
        
        ext_modules = ext_modules,
        
        packages = packages,
        package_dir = package_dir,
        #script_args = ["build_ext"],
        
        cmdclass = cmdclass,
        **extra_kwds
    )

if __name__ == '__main__':
    do_setup()