Monday, 9 September 2013

how to add library compilation to numpy.distutils.core?

how to add library compilation to numpy.distutils.core?

I'm trying make setup.py for my tiny module, which uses numpy. To compile
this module I need extra library which locates in same directory
ls -l audiotools
total 20
-rw-rw-r-- 1 rth rth 4405 Sep 9 10:58 audiotools.c
drwxr-xr-x 6 rth rth 4096 Sep 9 11:13 libresample-0.1.3
-rw-rw-r-- 1 rth rth 741 Sep 9 11:56 setup.py
So I need add something in setup.py which call configure and make in
libresample-0.1.3 and then add 'libresample.a' to the linker command.
I've tried used add_library, but it requires just source files but not
whole source directory. How I can do it?
This doesn't work.
def configuration(parent_package='', top_path=None):
import numpy
from numpy.distutils.misc_util import Configuration
config = Configuration('audiotools',parent_package,top_path)
config.add_extension('audiotools', ['audiotools.c'])
config.add_library('libresample',['libresample.a'])
return config
if __name__ == "__main__":
from numpy.distutils.core import setup
setup(
name = "audiotools",
version='0.01',
description='Python wrapper for GNU libresample-0.1.3 and
reader of Wave 24bit files',
author='Ruben Tikidji-Hamburyan, Timur Pinin',
author_email='rth@nisms.krinc.ru, timpin@rambler.ru',
configuration=configuration
)
Thanks!

No comments:

Post a Comment