python/tests/test_source.py: remove fragile brownnoise test, check duration on short...
[aubio.git] / setup.py
1 #! /usr/bin/env python
2
3 import sys, os.path, glob
4 from setuptools import setup, Extension
5 from python.lib.moresetuptools import *
6 # function to generate gen/*.{c,h}
7 from python.lib.gen_external import generate_external, header, output_path
8
9 # read from VERSION
10 for l in open('VERSION').readlines(): exec (l.strip())
11
12 if AUBIO_MAJOR_VERSION is None or AUBIO_MINOR_VERSION is None \
13         or AUBIO_PATCH_VERSION is None:
14     raise SystemError("Failed parsing VERSION file.")
15
16 __version__ = '.'.join(map(str, [AUBIO_MAJOR_VERSION,
17                                  AUBIO_MINOR_VERSION,
18                                  AUBIO_PATCH_VERSION]))
19 if AUBIO_VERSION_STATUS is not None:
20     if AUBIO_VERSION_STATUS.startswith('~'):
21         AUBIO_VERSION_STATUS = AUBIO_VERSION_STATUS[1:]
22     __version__ += AUBIO_VERSION_STATUS
23
24 include_dirs = []
25 library_dirs = []
26 define_macros = []
27 extra_link_args = []
28
29 include_dirs += [ 'python/ext' ]
30 include_dirs += [ output_path ] # aubio-generated.h
31 try:
32     import numpy
33     include_dirs += [ numpy.get_include() ]
34 except ImportError:
35     pass
36
37 if sys.platform.startswith('darwin'):
38     extra_link_args += ['-framework','CoreFoundation', '-framework','AudioToolbox']
39
40 sources = sorted(glob.glob(os.path.join('python', 'ext', '*.c')))
41
42 aubio_extension = Extension("aubio._aubio",
43     sources,
44     include_dirs = include_dirs,
45     library_dirs = library_dirs,
46     extra_link_args = extra_link_args,
47     define_macros = define_macros)
48
49 if os.path.isfile('src/aubio.h'):
50     if not os.path.isdir(os.path.join('build','src')):
51         __version__ += 'a2' # python only version
52
53 classifiers = [
54     'Development Status :: 4 - Beta',
55     'Environment :: Console',
56     'Intended Audience :: Science/Research',
57     'Topic :: Software Development :: Libraries',
58     'Topic :: Multimedia :: Sound/Audio :: Analysis',
59     'Topic :: Multimedia :: Sound/Audio :: Sound Synthesis',
60     'Operating System :: POSIX',
61     'Operating System :: MacOS :: MacOS X',
62     'Operating System :: Microsoft :: Windows',
63     'Programming Language :: C',
64     'Programming Language :: Python',
65     'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
66     ]
67
68 distrib = setup(name='aubio',
69     version = __version__,
70     packages = ['aubio'],
71     package_dir = {'aubio':'python/lib/aubio'},
72     scripts = ['python/scripts/aubiocut'],
73     ext_modules = [aubio_extension],
74     description = 'a collection of tools for music analysis',
75     long_description = 'a collection of tools for music analysis',
76     license = 'GNU/GPL version 3',
77     author = 'Paul Brossier',
78     author_email = 'piem@aubio.org',
79     maintainer = 'Paul Brossier',
80     maintainer_email = 'piem@aubio.org',
81     url = 'http://aubio.org/',
82     platforms = 'any',
83     classifiers = classifiers,
84     install_requires = ['numpy'],
85     cmdclass = {
86         'clean': CleanGenerated,
87         'build_ext': build_ext,
88         },
89     test_suite = 'nose2.collector.collector',
90     )