source: setup.py @ 1772630

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

setup.py: only generate source files in build_ext

  • Property mode set to 100755
File size: 3.3 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
56classifiers = [
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    ]
70
71from distutils.command.build_ext import build_ext as _build_ext
72class 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
79distrib = setup(name='aubio',
80    version = __version__,
81    packages = ['aubio'],
82    package_dir = {'aubio':'python/lib/aubio'},
83    scripts = ['python/scripts/aubiocut'],
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,
95    install_requires = ['numpy'],
96    cmdclass = {
97        'clean': CleanGenerated,
98        'generate': GenerateCommand,
99        'build_ext': build_ext,
100        },
101    test_suite = 'nose2.collector.collector',
102    )
Note: See TracBrowser for help on using the repository browser.