[Numpy-discussion] numpy build system questions for use in another project (fwrap)

David david@silveregg.co...
Fri Apr 9 02:25:14 CDT 2010


On 04/07/2010 11:52 AM, Kurt Smith wrote:
> Briefly, I'm encountering difficulties getting things working in numpy
> distutils for fwrap's build system.
>
> Here are the steps I want the build system to accomplish:
>
> 1) Compile a directory of Fortran 90 source code -- this works.
>      - The .mod files generated by this compilation step are put in the
> build directory.

This is difficult - fortran modules are a PITA from a build perspective. 
Many compilers don't seem to have a way to control exactly where to put 
the generated .mod, so the only way I am aware of to control this is to 
cwd the process into the build directory...

This was also a problem when I worked on fortran support for waf (see 
http://groups.google.com/group/waf-users/browse_thread/thread/889e2a5e5256e420/84ee939e93c9e30f?lnk=gst&q=fortran+modules#84ee939e93c9e30f 
)

>
> My problem is in instantiating numpy.distutils.config such that it is
> appropriately configured with command line flags.
>
> I've tried the following with no success:
>
> ('self' is a build_ext instance)
> cfg = self.distribution.get_command_obj('config')
> cfg.initialize_options()
> cfg.finalize_options()  # doesn't do what I hoped it would do.
>
> This creates a config object, but it doesn't use the command line
> flags (e.g. --fcompiler=gfortran doesn't affect the fortran compiler
> used).

Why don't you do the testing in config ? That's how things are done 
normally, unless you have a reason to do otherwise. Concerning the 
--fcompiler option, how do you pass --fcompiler (what is the exact list 
of commands you used to call distutils here) ? Generally, given the 
general command/option screw up, the only real solution really is to 
pass the options to each command, and hope each one is the same.

> Any pointers?  More generally -- seeing the above, any ideas on how to
> go about doing what I'm trying to do better?

Not really, that's how you are supposed to do things with distutils,

David


More information about the NumPy-Discussion mailing list