[Distutils] Newbie building SWIG wrappers with distutils
wtbridgman at radix.net
Wed Jul 23 23:20:50 EDT 2003
I searched the list archives and found some mention of getting SWIG
v1.3 working with distutils but I couldn't find anything on the results
of that effort.
I've got a set of python modules that I'm beginning to convert to C/C++
extensions and some C/C++ code I want to wrap for Python using SWIG
v1.3. I can get the extensions to build and work on their own (MacOS X
10.2.4, MacPython 2.3b1) but I can't get a distutils module to build
My package directory looks something like this:
where moduleA, moduleB are currently pure python but which may
eventually converted to wrappers around C code and moduleC is being
built as an extension.
Based on the docs and study of other setup.py scripts, my script looks
extra_compile_args = extra_compile_args,
setup(name='WTBlib',version = "0.1",
packages = packages,
package_dir = package_dir,
description = "",
include_dirs = include_dirs,
ext_package = "WTBlib",
ext_modules = ext_modules)
Currently, it fails trying to build the SWIG wrapper. So I built the
wrappers manually (moduleC_wrap.c and moduleC.py and modified setup.py
I expected it to build in site-packages something like:
which I believe is what I want. However, after having to modify things
like #include paths in the wrapper file I can finally get it to build
which just doesn't work at all. Pretends to import but no guts in the
Part of my problem is clearly that I don't understand how each of the
components entered into the setup.py gets transformed into a path for
such things as file copy and compilation parameters. Is there a better
source of info on that?
What is the status of letting distutils build the wrapper files?
Also, just what is the __init__.py file for and is there ever a reason
to put routines in it?
More information about the Distutils-SIG