[Numpy-discussion] numpy.distutils: building a f2py in a subdir
Pearu Peterson
pearu at cens.ioc.ee
Sun May 18 06:49:00 EDT 2008
On Sun, May 18, 2008 1:14 pm, David Cournapeau 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'])
A safe approach would be to create a foo/setup.py that contains
config.add_extension('bar', source = ['bar.pyf'])
and in the parent setup.py add
config.add_subpackage('foo')
(you might also need creating foo/__init__.py).
> But it does not work right now because of the way numpy.distutils finds
> the name of the extension. Replacing:
>
> ext_name = extension.name.split('.')[-1]
>
> by
>
> ext_name = os.path.basename(extension.name.split('.')[-1])
>
> Seems to make it work. Could that break anything in numpy.distutils ? I
> don't see how, but I don't want to touch distutils without being sure it
> won't,
The change should not break anything that already works because
in distutils extension name is assumed to contain names joined with a dot.
If distutils works with / in extension name, then I think it is because
by an accident. I'd recommend checking this also on a windows system
before changing numpy.distutils, not sure if it works or not there..
Pearu
More information about the NumPy-Discussion
mailing list