471,326 Members | 2,144 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,326 software developers and data experts.

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

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

Oct 10 '07 #1
0 1055

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Anthony Baxter | last post: by
3 posts views Thread by Kevin Dahlhausen | last post: by
1 post views Thread by Michael A. Covington | last post: by
reply views Thread by John Ling | last post: by
9 posts views Thread by rn5a | last post: by
7 posts views Thread by John Nagle | last post: by
2 posts views Thread by mk | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.