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

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

Post by maur » Thu, 11 Oct 2007 20:36:12


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
 
 
 

1. Announcing atomfeed.py, xmlelements.py, and feedutils.py

2. Sample distutil setup.py script that uses SWIG and C++?

Could anyone post a simple setup.py script that uses a SWIG interface
to C++ code and the mingw compiler?

I followed some online samples, and am using the setup.cfg file to
specify swig-c++=1.

Trying to build using mingw out of the cygwin environment but the
final call to link the extension calls directly to 'cc' which I think
should really be g++ at that point.

Did get everything to build with a Makefile, but that's not the right
way to go.

3. Can I use setup.py to ship and install only .pyc files?

4. setup.py and file extensions like ".c++"

5. setup.py and MANIFEST.in - duplicating inclusion of files?

6. .Py ***Hot stuff - check this out !!! .Py

7. ANN: py lib 0.9.0: py.test, distributed execution, microthreads ...

8. to py or not to py ?

9. can't build py-opengl

10. Py is Dead! Long live Py!

11. Problem building port py-imaging

12. py.test-1.3.1: new py.test.xfail, --maxfail, better reporting, fixes

13. Jython: Packing several .py on .jar, problem importing .py modules within the .jar

14. freeze.py builds, but binary doesn't even run locally (shared GTK problem?)

15. Failure in test_hashlib.py and test_hmac.py