[Distutils] first cut at fortran support for distutils

Pearu Peterson Pearu Peterson <pearu@cens.ioc.ee>
Fri Aug 31 13:03:01 2001


I completely agree with Paul's concerns below but I don't think that
nothing should be done in this matter.

Playing with compiler flags is rare (you can find
optimal flag configuration once, later may be change it a bit) relative to
the actual compilation of Fortran programs that are developed in
connection with Python (here talking based on my experience). So, it would
be very useful if Fortran codes could be compiled within setup.py.

And more importantly, one could crab, say from Internet, a Python package
containing Fortran codes and build it from scratch (rather than
messing with Makefiles that are platform dependent even on unices). 
Here assuming that support for Fortran compilers is set up properly
locally  - this is not a problem on unices, don't know about windows.

So, I think that that the work of Eric and Travis  is relevant and very


On Thu, 30 Aug 2001, Paul F. Dubois wrote:

> The concern I have is that Fortran is not in the same boat here that C
> is. C compilations can get their command-line arguments by default at
> least by using the settings that Python was compiled with, and that was
> determined by a configuration process.
> For Fortran, there is no such crutch so any new compiler will have to be
> added to distutils by hand. And Fortran users are much more likely IMHO
> to want to fool around with the flags.
> The approach I took in Pyfort was to assume that the USER could make the
> static library. That reduces the question to (a) getting the right
> run-time modules linked and (b) writing a wrapper so the functions can
> be called from Fortran.
> But (a) actually depends on the compiler flags used, and of course (b)
> has to be done some way or the other, either by hand or with a tool.
> Pyfort therefore uses distutils to do the link and by default includes
> the basic libraries into the libdir and dirlist lists, and the user can
> then add to that via the Pyfort command line. So I didn't need any
> changes to distutils itself, I just used it from my Python.