[Numpy-discussion] distutils for a Pyrex module

pearu@cens.i... pearu@cens.i...
Tue Mar 20 17:13:26 CDT 2007


> On Tuesday 20 March 2007 17:46:28 Robert Kern wrote:
>
>> The first file in the sources list should be the one that actually
>> implements the module, i.e. the C file generated by Pyrex. FORTRAN files
>> specified after the first one won't be processed by f2py.
>
> Mmh. I had to get rid of the '*.pyx' and '*.pxd' lines as numpy.distutils
> complained of a multiple definition of initcloess.
> However, that still doesn't work: I switched the order of f_sources and
> c_sources to
>>>>sources=[join('src', x) for x in (c_sources+f_sources)],
> where c_sources now have 'cloess.c' as first element (that's the output of
> pyrex), and f2py still processes the fortran sources. At the end, the
> module
> contains only the f2py-processed fortran subroutines, which are useless on
> their own.
> I'm obviously missing something. Any other idea ?

In case you only need to compile fortran sources for linking with
an extension module then specify fortran sources under libraries.
For example,

  config.add_library('somename', sources = f_sources)
  config.add_extension('extname', sources = c_courses,
                       libraries = ['somename'])

HTH,
Pearu



More information about the Numpy-discussion mailing list