[9aa0af3] | 1 | #! /usr/bin/env python |
---|
[c71e405] | 2 | |
---|
[2675227] | 3 | import sys, os.path, glob |
---|
[1167631] | 4 | from setuptools import setup, Extension |
---|
[2675227] | 5 | from python.lib.moresetuptools import * |
---|
[1167631] | 6 | # function to generate gen/*.{c,h} |
---|
| 7 | from python.lib.gen_external import generate_external, header, output_path |
---|
[012b324] | 8 | |
---|
[945e26d] | 9 | # read from VERSION |
---|
[ad5203c] | 10 | for l in open('VERSION').readlines(): exec (l.strip()) |
---|
[945e26d] | 11 | __version__ = '.'.join \ |
---|
| 12 | ([str(x) for x in [AUBIO_MAJOR_VERSION, AUBIO_MINOR_VERSION, AUBIO_PATCH_VERSION]]) \ |
---|
| 13 | + AUBIO_VERSION_STATUS |
---|
| 14 | |
---|
[41399bd] | 15 | include_dirs = [] |
---|
| 16 | library_dirs = [] |
---|
| 17 | define_macros = [] |
---|
[4d3b573] | 18 | extra_link_args = [] |
---|
[012b324] | 19 | |
---|
[1167631] | 20 | include_dirs += [ 'python/ext' ] |
---|
[a89ed31] | 21 | include_dirs += [ output_path ] # aubio-generated.h |
---|
[5f6324e] | 22 | try: |
---|
| 23 | import numpy |
---|
| 24 | include_dirs += [ numpy.get_include() ] |
---|
| 25 | except ImportError: |
---|
| 26 | pass |
---|
[ad5203c] | 27 | |
---|
[4d3b573] | 28 | if sys.platform.startswith('darwin'): |
---|
| 29 | extra_link_args += ['-framework','CoreFoundation', '-framework','AudioToolbox'] |
---|
| 30 | |
---|
[2675227] | 31 | sources = glob.glob(os.path.join('python', 'ext', '*.c')) |
---|
| 32 | |
---|
| 33 | aubio_extension = Extension("aubio._aubio", |
---|
| 34 | sources, |
---|
[4d3b573] | 35 | include_dirs = include_dirs, |
---|
| 36 | library_dirs = library_dirs, |
---|
| 37 | extra_link_args = extra_link_args, |
---|
[2675227] | 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 | |
---|
[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 | |
---|
[b1d37c0] | 71 | from distutils.command.build_ext import build_ext as _build_ext |
---|
| 72 | class build_ext(_build_ext): |
---|
| 73 | |
---|
| 74 | def build_extension(self, extension): |
---|
| 75 | # generate files python/gen/*.c, python/gen/aubio-generated.h |
---|
| 76 | extension.sources += generate_external(header, output_path, overwrite = False) |
---|
| 77 | return _build_ext.build_extension(self, extension) |
---|
| 78 | |
---|
[945e26d] | 79 | distrib = setup(name='aubio', |
---|
[4d3b573] | 80 | version = __version__, |
---|
| 81 | packages = ['aubio'], |
---|
[1167631] | 82 | package_dir = {'aubio':'python/lib/aubio'}, |
---|
| 83 | scripts = ['python/scripts/aubiocut'], |
---|
[4d3b573] | 84 | ext_modules = [aubio_extension], |
---|
| 85 | description = 'interface to the aubio library', |
---|
| 86 | long_description = 'interface to the aubio library', |
---|
| 87 | license = 'GNU/GPL version 3', |
---|
| 88 | author = 'Paul Brossier', |
---|
| 89 | author_email = 'piem@aubio.org', |
---|
| 90 | maintainer = 'Paul Brossier', |
---|
| 91 | maintainer_email = 'piem@aubio.org', |
---|
| 92 | url = 'http://aubio.org/', |
---|
| 93 | platforms = 'any', |
---|
| 94 | classifiers = classifiers, |
---|
[16f8dcc] | 95 | install_requires = ['numpy'], |
---|
[a89ed31] | 96 | cmdclass = { |
---|
| 97 | 'clean': CleanGenerated, |
---|
| 98 | 'generate': GenerateCommand, |
---|
[b1d37c0] | 99 | 'build_ext': build_ext, |
---|
[1167631] | 100 | }, |
---|
| 101 | test_suite = 'nose2.collector.collector', |
---|
[4d3b573] | 102 | ) |
---|