[New-bugs-announce] [issue4672] Distutils SWIG support blocks use of SWIG -outdir option

Andy Buckley report at bugs.python.org
Mon Dec 15 23:22:32 CET 2008


New submission from Andy Buckley <andy at insectnation.org>:

When using distutils to build an extension module using SWIG, it makes
most sense to use the built-in SWIG support. However, the distutils seem
to "vet" the options passed via the Extension.swig_opts attr/arg:

[...]
ext_modules=[Extension('_hepmc', ['@top_srcdir@/hepmc.i'],
               swig_opts=['-c++', '-I at HEPMCINCPATH@', '-outdir .'],
               include_dirs=['@HEPMCINCPATH@'],
               library_dirs=['@HEPMCLIBPATH@'],
               libraries=['HepMC'])],
[...]

results in this error:

building '_hepmc' extension
swigging ./hepmc.i to ./hepmc_wrap.cpp
swig -python -c++ -I/home/andy/heplocal/include -outdir . -o
./hepmc_wrap.cpp ./hepmc.i
swig error : Unrecognized option -outdir .
Use 'swig -help' for available options.
error: command 'swig' failed with exit status 1

but calling the same swig command works fine. It's the same copy of
swig, but it seems to be distutils rather than swig that is throwing the
error. This is particularly relevant since I need to use -outdir to meet
the autotools "distcheck" requirement of successfully building from a
build-dir separate from the source dir: code generation tools like SWIG
blur such a distinction and so need to support output location flags
like -outdir.

I see this was also noticed some time ago:
http://osdir.com/ml/python.distutils.devel/2006-06/msg00009.html
but no useful reply was ever forthcoming ;(  Maybe this time will be
luckier!

----------
components: Distutils
messages: 77883
nosy: andybuckley
severity: normal
status: open
title: Distutils SWIG support blocks use of SWIG -outdir option
type: behavior
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4672>
_______________________________________


More information about the New-bugs-announce mailing list