unify version parsing in Version.py
[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 from Version import get_aubio_version, get_aubio_pyversion
9
10 __version__ = get_aubio_version()
11 __pip_version__ = get_aubio_pyversion()
12
13 include_dirs = []
14 library_dirs = []
15 define_macros = [('AUBIO_VERSION', '%s' % __version__)]
16 extra_link_args = []
17
18 include_dirs += [ 'python/ext' ]
19 include_dirs += [ output_path ] # aubio-generated.h
20 try:
21     import numpy
22     include_dirs += [ numpy.get_include() ]
23 except ImportError:
24     pass
25
26 if sys.platform.startswith('darwin'):
27     extra_link_args += ['-framework','CoreFoundation', '-framework','AudioToolbox']
28
29 sources = sorted(glob.glob(os.path.join('python', 'ext', '*.c')))
30
31 aubio_extension = Extension("aubio._aubio",
32     sources,
33     include_dirs = include_dirs,
34     library_dirs = library_dirs,
35     extra_link_args = extra_link_args,
36     define_macros = define_macros)
37
38 if os.path.isfile('src/aubio.h'):
39     if not os.path.isdir(os.path.join('build','src')):
40         pass
41         #__version__ += 'a2' # python only version
42
43 classifiers = [
44     'Development Status :: 4 - Beta',
45     'Environment :: Console',
46     'Intended Audience :: Science/Research',
47     'Topic :: Software Development :: Libraries',
48     'Topic :: Multimedia :: Sound/Audio :: Analysis',
49     'Topic :: Multimedia :: Sound/Audio :: Sound Synthesis',
50     'Operating System :: POSIX',
51     'Operating System :: MacOS :: MacOS X',
52     'Operating System :: Microsoft :: Windows',
53     'Programming Language :: C',
54     'Programming Language :: Python',
55     'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
56     ]
57
58 distrib = setup(name='aubio',
59     version = __pip_version__,
60     packages = ['aubio'],
61     package_dir = {'aubio':'python/lib/aubio'},
62     scripts = ['python/scripts/aubiocut'],
63     ext_modules = [aubio_extension],
64     description = 'a collection of tools for music analysis',
65     long_description = 'a collection of tools for music analysis',
66     license = 'GNU/GPL version 3',
67     author = 'Paul Brossier',
68     author_email = 'piem@aubio.org',
69     maintainer = 'Paul Brossier',
70     maintainer_email = 'piem@aubio.org',
71     url = 'https://aubio.org/',
72     platforms = 'any',
73     classifiers = classifiers,
74     install_requires = ['numpy'],
75     setup_requires = ['numpy'],
76     cmdclass = {
77         'clean': CleanGenerated,
78         'build_ext': build_ext,
79         },
80     test_suite = 'nose2.collector.collector',
81     extras_require = {
82         'tests': ['numpy'],
83         },
84     )