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 | __version__ = '.'.join \ |
---|
12 | ([str(x) for x in [AUBIO_MAJOR_VERSION, AUBIO_MINOR_VERSION, AUBIO_PATCH_VERSION]]) \ |
---|
13 | + AUBIO_VERSION_STATUS |
---|
14 | |
---|
15 | include_dirs = [] |
---|
16 | library_dirs = [] |
---|
17 | define_macros = [] |
---|
18 | extra_link_args = [] |
---|
19 | |
---|
20 | include_dirs += [ 'python/ext' ] |
---|
21 | include_dirs += [ output_path ] # aubio-generated.h |
---|
22 | try: |
---|
23 | import numpy |
---|
24 | include_dirs += [ numpy.get_include() ] |
---|
25 | except ImportError: |
---|
26 | pass |
---|
27 | |
---|
28 | if sys.platform.startswith('darwin'): |
---|
29 | extra_link_args += ['-framework','CoreFoundation', '-framework','AudioToolbox'] |
---|
30 | |
---|
31 | sources = glob.glob(os.path.join('python', 'ext', '*.c')) |
---|
32 | |
---|
33 | aubio_extension = Extension("aubio._aubio", |
---|
34 | sources, |
---|
35 | include_dirs = include_dirs, |
---|
36 | library_dirs = library_dirs, |
---|
37 | extra_link_args = extra_link_args, |
---|
38 | define_macros = define_macros) |
---|
39 | |
---|
40 | if os.path.isfile('src/aubio.h'): |
---|
41 | # if aubio headers are found in this directory |
---|
42 | add_local_aubio_header(aubio_extension) |
---|
43 | # was waf used to build the shared lib? |
---|
44 | if os.path.isdir(os.path.join('build','src')): |
---|
45 | # link against build/src/libaubio, built with waf |
---|
46 | add_local_aubio_lib(aubio_extension) |
---|
47 | else: |
---|
48 | # add libaubio sources and look for optional deps with pkg-config |
---|
49 | add_local_aubio_sources(aubio_extension) |
---|
50 | __version__ += '_libaubio' |
---|
51 | else: |
---|
52 | # look for aubio headers and lib using pkg-config |
---|
53 | add_system_aubio(aubio_extension) |
---|
54 | |
---|
55 | |
---|
56 | # generate files if they don't exit |
---|
57 | aubio_extension.sources += generate_external(header, output_path, overwrite = False) |
---|
58 | |
---|
59 | classifiers = [ |
---|
60 | 'Development Status :: 4 - Beta', |
---|
61 | 'Environment :: Console', |
---|
62 | 'Intended Audience :: Science/Research', |
---|
63 | 'Topic :: Software Development :: Libraries', |
---|
64 | 'Topic :: Multimedia :: Sound/Audio :: Analysis', |
---|
65 | 'Topic :: Multimedia :: Sound/Audio :: Sound Synthesis', |
---|
66 | 'Operating System :: POSIX', |
---|
67 | 'Operating System :: MacOS :: MacOS X', |
---|
68 | 'Operating System :: Microsoft :: Windows', |
---|
69 | 'Programming Language :: C', |
---|
70 | 'Programming Language :: Python', |
---|
71 | 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', |
---|
72 | ] |
---|
73 | |
---|
74 | distrib = setup(name='aubio', |
---|
75 | version = __version__, |
---|
76 | packages = ['aubio'], |
---|
77 | package_dir = {'aubio':'python/lib/aubio'}, |
---|
78 | scripts = ['python/scripts/aubiocut'], |
---|
79 | ext_modules = [aubio_extension], |
---|
80 | description = 'interface to the aubio library', |
---|
81 | long_description = 'interface to the aubio library', |
---|
82 | license = 'GNU/GPL version 3', |
---|
83 | author = 'Paul Brossier', |
---|
84 | author_email = 'piem@aubio.org', |
---|
85 | maintainer = 'Paul Brossier', |
---|
86 | maintainer_email = 'piem@aubio.org', |
---|
87 | url = 'http://aubio.org/', |
---|
88 | platforms = 'any', |
---|
89 | classifiers = classifiers, |
---|
90 | install_requires = ['numpy'], |
---|
91 | cmdclass = { |
---|
92 | 'clean': CleanGenerated, |
---|
93 | 'generate': GenerateCommand, |
---|
94 | }, |
---|
95 | test_suite = 'nose2.collector.collector', |
---|
96 | ) |
---|