build outside C code with scons within numpy distutils

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

build outside C code with scons within numpy distutils

Zachary Pincus-2
Hello all,

I've been following David's work making numpy build with scons with  
some interest. I have a quick question about how one might use scons/
numpy distutils from an outside project.

Specifically, I have a package that uses numpy and numpy.distutils to  
built itself. Unfortunately, there are some pure-C libraries that I  
call using ctypes, and as these libraries are are not python  
extensions, it is hard to get distutils to build them happily on all  
platforms. From what I understand, one of the benefits of having scons  
available was that building and packaging these sort of libraries  
would become easier.

Is that the case? And if so, what would be the best way to add the  
scons stuff to a simple setup.py file written for numpy.distutils?

Thanks,
Zach
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: build outside C code with scons within numpy distutils

David Cournapeau-4
On Sun, 2008-05-25 at 11:25 -0400, Zachary Pincus wrote:

> Specifically, I have a package that uses numpy and numpy.distutils to  
> built itself. Unfortunately, there are some pure-C libraries that I  
> call using ctypes, and as these libraries are are not python  
> extensions, it is hard to get distutils to build them happily on all  
> platforms.

You can take a look at the examples in numscons sources
(sources/tests/ctypesext).

In the setup.py, you call config.add_sconscript('SConstruct')

And in the scons script, you do:

from numscons import GetNumpyEnvironment
env = GetNumpyEnvironment(ARGUMENTS)

env.NumpyCtypes('foo', source = ['foo.c'])

Note that although this has not changed since it existed, I do not
guarantee API stability at this point.

cheers,

David

_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: build outside C code with scons within numpy distutils

Zachary Pincus-2
Thanks for the tips! This is very helpful.


>> Specifically, I have a package that uses numpy and numpy.distutils to
>> built itself. Unfortunately, there are some pure-C libraries that I
>> call using ctypes, and as these libraries are are not python
>> extensions, it is hard to get distutils to build them happily on all
>> platforms.
>
> You can take a look at the examples in numscons sources
> (sources/tests/ctypesext).
>
> In the setup.py, you call config.add_sconscript('SConstruct')
>
> And in the scons script, you do:
>
> from numscons import GetNumpyEnvironment
> env = GetNumpyEnvironment(ARGUMENTS)
>
> env.NumpyCtypes('foo', source = ['foo.c'])
>
> Note that although this has not changed since it existed, I do not
> guarantee API stability at this point.
>
> cheers,
>
> David
>
> _______________________________________________
> Numpy-discussion mailing list
> [hidden email]
> http://projects.scipy.org/mailman/listinfo/numpy-discussion

_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion