[Numpy-discussion] f2py-users list not working

George Nurser gnurser@googlemail....
Wed Nov 4 11:49:32 CST 2009


2009/11/4 Robin <robince@gmail.com>:
> On Wed, Nov 4, 2009 at 2:38 PM, George Nurser <gnurser@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?

If it's just search-and-replace, of course python can do it directly....

--George


More information about the NumPy-Discussion mailing list