On Jul 21, 2009, at 12:08 PM, Willem Jan Palenstijn wrote:

>
> On Tue, Jul 21, 2009 at 03:30:37AM -0700, Nathann Cohen wrote:
>>
>> Hello everybody !!!
>>
>> I have a small problem I discussed with some of you on IRC already.
>>
>> I have written a Cython class which should one day be integrated into
>> the standard version of SAGE : an interface for numerical solvers of
>> linear programs. Some of these solvers, though, are optional SPKG
>> ( but most of the people using this class will probably install
>> them ), and I also wrote their interfaces in Cython. I would like my
>> first standard class to be compiled according to the available
>> solver's libraries, and I see no way of doing it.
>
> I think a clean way to do this would be to package the Cython wrapper
> for the optional SPKG inside that SPKG. Then it would get compiled
> only when the SPKG is installed. Inside sage you could then detect at
> run-time if the wrapper module is importable, and if so, use it.
>
> There doesn't seem to be any sage-specific infrastructure currently  
> for
> putting Cython code in an .spkg (Unless I missed it, which is quite
> possible). Maybe we could generalize the code in
> sage/setup.py a little bit to make it importable in an spkg's setup.py
> script?
>
> But that could also be overkill and it might be easier to just use
> cython's distutils extension like described at
> http://docs.cython.org/docs/source_files_and_compilation.html#basic- 
> setup-py

For Cython code in spkgs that don't have a large number of  
dependancies, this is certainly the best way to go. This is what we  
do in Cython itself (though that's probably not the simplest example  
to look at, as it boostraps itself...).

Numpy provides a get_include() to make this easy, perhaps we could do  
the same for Sage to get an easy path to sage/local/include and sage/ 
local/lib (not that these aren't easy to pull from the environment as  
well).

- Robert



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to