changing build order for SWIG extensions

T

timothy.williams

Hi all.


How do I tell distutils to run build_ext before build_py when I try to
do a

'python setup.py build' ?

I have a C extension using SWIG, and when I build with setup.py,
build_py runs on the current module.py file before swig
creates/recreates it. I got around it by just putting in another call
to setup for the py_module, but if I try to create a bdist, the second
call to setup over writes the first w/o the _module.so file.

(bottom of setup.py)

# build extension module
setup (name = 'OTB_libs',
version='1.0',
author="Tim Williams",
packages=['OTB_libs'],
package_dir={'OTB_libs':''},
ext_modules=[Extension('OTB_libs._OTB_libs',
sources=['OTB_libs.i'],
include_dirs=INCLDIRS,
library_dirs=LIBDIRS,
libraries=liblist,
extra_compile_args=['-malign-double'],
swig_opts=swig_opts
)
]
)

#this needs to be built after the extension is since OTB_libs.py is
#generated by SWIG
setup (name='OTB_libs',
version='1.0',
author="Tim Williams",
py_modules=['OTB_libs.OTB_libs'],
package_dir={'OTB_libs':''}
)

Am I stuck with just calling running 'python setup.py build' twice?

Thanks for any help.
 

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,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top