[Numpy-discussion] f2py - how to use .pyf files?

Robert Kern robert.kern at gmail.com
Fri Jul 18 19:47:08 EDT 2008


On Fri, Jul 18, 2008 at 18:35, Fernando Perez <fperez.net at gmail.com> wrote:
> On Fri, Jul 18, 2008 at 4:26 PM, Robert Kern <robert.kern at gmail.com> wrote:
>> On Fri, Jul 18, 2008 at 18:19, Fernando Perez <fperez.net at gmail.com> wrote:
>>> On Fri, Jul 18, 2008 at 3:53 PM, Robert Kern <robert.kern at gmail.com> wrote:
>>>
>>>> You still need "-m text2", I believe.
>>>
>>> Right, thanks.  But it still doesn't quite work.  Consider a makefile with
>>>
>>> lib: seglib.so
>>>
>>> seglib.so: Text2.f90
>>>        f2py -c --fcompiler=gnu95 -m seglib Text2.f90
>>>
>>> pyf: Text2.f90
>>>        f2py -h seglib.pyf -m seglib Text2.f90 --overwrite-signature
>>>
>>> lib2: Text2.f90
>>>        f2py -c --fcompiler=gnu95 seglib.pyf
>>
>> You still need to have Text2.f90 on the line.
>
> Ahah!  I went on this:
>
>  -h <filename>    Write signatures of the fortran routines to file <filename>
>                   and exit. You can then edit <filename> and use it
> ***instead***
>                   of <fortran files>.
>
> [emphasis mine].  The instead there led me to think that I should NOT
> list the fortran files.  Should that docstring be fixed, or am I just
> misreading something?
>
> And do you have any ideas on why the f2py_options in setup.py don't
> correctly pass the --fcompiler flag down to f2py?  It does work if one
> calls setup.py via
>
> ./setup.py config_fc --fcompiler=gnu95 build_ext --inplace
>
> but it seems it would be good to be able to set all f2py options
> inside the setup.py file (without resorting to sys.argv hacks).  Or
> does this go against the grain of numpy.distutils?

For publicly distributed packages, it does go against the grain. Never
hard-code the compiler! Use a setup.cfg file, instead.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco



More information about the NumPy-Discussion mailing list