source: setup.py @ 5f6324e

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 5f6324e was 5f6324e, checked in by Paul Brossier <piem@piem.org>, 9 years ago

setup.py: do not fail if numpy is not installed yet

  • Property mode set to 100755
File size: 3.1 KB
Line 
1#! /usr/bin/env python
2
3import sys, os.path, glob
4from setuptools import setup, Extension
5from python.lib.moresetuptools import *
6# function to generate gen/*.{c,h}
7from python.lib.gen_external import generate_external, header, output_path
8
9# read from VERSION
10for 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
15include_dirs = []
16library_dirs = []
17define_macros = []
18extra_link_args = []
19
20include_dirs += [ 'python/ext' ]
21include_dirs += [ output_path ] # aubio-generated.h
22try:
23    import numpy
24    include_dirs += [ numpy.get_include() ]
25except ImportError:
26    pass
27
28if sys.platform.startswith('darwin'):
29    extra_link_args += ['-framework','CoreFoundation', '-framework','AudioToolbox']
30
31sources = glob.glob(os.path.join('python', 'ext', '*.c'))
32
33aubio_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
40if 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'
51else:
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
57aubio_extension.sources += generate_external(header, output_path, overwrite = False)
58
59classifiers = [
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
74distrib = 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    )
Note: See TracBrowser for help on using the repository browser.