[Numpy-discussion] f2py-users list not working

Robin robince at gmail.com
Wed Nov 4 10:53:01 EST 2009

On Wed, Nov 4, 2009 at 2:38 PM, George Nurser <gnurser at googlemail.com> wrote:
> Fortran can accept preprocessor directives, but f2py cannot.
> You first need to preprocess a .F (or .F90) file to create a .f (or
> .f90) file which you then pass to f2py
> The way I preprocess the .F file is to have statements like
> int int*INTSIZE :: i,j,k
> So preprocess file.F e.g. in gfortran with
> gfortran -E -DINTSIZE=8 file.F  -o outdir/file.f
> The outdir is necessary in a case-insensitive file system (like
> default mac OSX) to prevent the .f files overwriting the .F file.
> Alternatively, it may be possible to use some other suffix than .f,
> but I've not tried that.
> Then f2py file.f

That's great thanks very much! It's more or less exactly what I was hoping for.

I wonder if it's possible to get distutils to do the preprocess step
from a setup.py script?



More information about the NumPy-Discussion mailing list