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