setup.py build & SWIG: missing py files (they are outside the build directory)

M

mauro

Hi all,
I am trying to make a package distribution containing some extension
module written in C. The problem is that when I run setup.py some
files are generated in the wrong position.
Suppose that this is my setup.py:

from distutils.core import setup, Extension

setup(name='foo',
package_dir = {"foo" : "src"},
packages=['foo',
'foo.spam',
],
ext_modules=[
Extension("foo.spam._spam",
sources=['src/spam/spam.i',
'src/spam/spam.cc',
],
)
]
)

Here is an example of what I get after running:

python setup.py build -cmingw32 bdist

..\
+build\
+lib.win32-2.4\
+foo\
+spam\
__init__.py
_spam.pyd
__init__.py
foo.py
+src\
+dist\
foo-0.0.win32.zip
setup.py
spam.py

So the problem is that spam.py (generated by SWIG) is not in .\build
\lib.win32-2.4\foo\spam but in the same directory as setup.py!
Of course I can move it manually, but I have to update also
foo-0.0.win32.zip and all this is quite annoying...
Did I miss some option in the setup? Is it possible to run a system
command (copy) after each extension is compiled and linked and the
corresponding .py file is generated?
Thanks in advance!

Mauro
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top