[Numpy-discussion] numpy.distutils: building a f2py in a subdir

Robert Kern robert.kern@gmail....
Sun May 18 05:38:27 CDT 2008

On Sun, May 18, 2008 at 5:14 AM, David Cournapeau
<david@ar.media.kyoto-u.ac.jp> wrote:
> Hi,
>    I would like to be able to build a f2py extension in a subdir with
> distutils, that is:
> config.add_extension('foo/bar', source = ['foo/bar.pyf'])
> But it does not work right now because of the way numpy.distutils finds
> the name of the extension.

Is foo a subpackage and the extension is supposed to be imported as
parent.foo.bar (assuming the setup.py is for the "parent" package)? If
so, you want this:

config.add_extension('foo.bar', source=['foo/bar.pyf'])

If the source is just in a subdirectory, but bar.so should be imported
as "parent.bar", then you want this:

config.add_extension('bar', source=['foo/bar.pyf'])

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the Numpy-discussion mailing list