python + fortran: seeking help
petr
976F at ingv.it
Sun Jun 28 07:18:00 PDT 2015
Hi Mojca,
I admit I also had some hard times with getting the Fortran part of a Python package right, and it broke occasionally probably because I did it not right up front. Maybe I could help, if you tell me where you get stuck, or just provide some reference to your currently version of the Portfile.
Some general hints which might be helpful:
- f2py is now maintained by `numpy` and part of that packages;
- NumPy provides its own variant of distutils (numpy.distutils) with some extensions, which can be used in your `setup.py` file. But be warned that there are some inconsistencies in how flags are handled (compared to the C part).
- from what I remember, you should keep using the same C compiler for your C extensions (especially C++) as was used to compile Python itself. In general this is handled correctly by using the defaults, but you should not try to force the C compiler from the same suite as the Fortran compiler.
- Using the C extension defaults, I remember the linking step will fail as it will not know about the fortran library. If this is the problem, I can lookup which at the end made the trick. I now do not remember, as I was toying around with two possibilities (at least).
I also believe, that if you have an extension in Fortran, but do not set a Fortran compiler, usually your Python build as a whole will fail. So you probably will need some mechanism (option) to deactivate or activate this part of the package. Or maybe you would want to single out this part into a separate port, if this is possible.
Cheers!
~petr
On 28 Jun 2015, at 11:14, Mojca Miklavec <mojca at macports.org> wrote:
> On Sun, Jun 28, 2015 at 11:09 AM, Mojca Miklavec wrote:
>>
>> One of things that I would like to get right are the variants to
>> switch between different Fortran compilers (possibly explicitly
>> disabling Fortran support by default).
>
> And the other thing is "f2py" which doesn't exist as such, only in a
> form of "f2py-2.7" and "f2py-3.4". Or by explicitly adding
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin
> to PATH.
>
> The question is: is it worth bothering the developers to start
> supporting f2py-2.7, even if I would have to set a variable like
> F2PY=f2py-2.7.
>
> What's the best way to handle those "-2.7" additions to python programs?
>
> Mojca
> _______________________________________________
> macports-dev mailing list
> macports-dev at lists.macosforge.org
> https://lists.macosforge.org/mailman/listinfo/macports-dev
More information about the macports-dev
mailing list