[Patches] [ python-Patches-1479255 ] Fix building with SWIG's -c++ option set in setup.py

SourceForge.net noreply at sourceforge.net
Fri Mar 23 14:45:11 CET 2007


Patches item #1479255, was opened at 2006-04-30 10:24
Message generated for change (Comment added) made by fremen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1479255&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Distutils and setup.py
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: dOb (d0b)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fix building with SWIG's -c++ option set in setup.py

Initial Comment:
When the '--swig-opts -c++' command line option is
used, the target extension is changed from .c to .cpp
but when the '-c++' option is passed to an Extension
with the swig_opts keyword argument, the target
extension is not changed. This causes the compiler to
treat the C++ source as C and fail.

With the patch distutils uses the Extension's swig_opts
argument in addition to the command line options to
determine if the target extension should be .c or .cpp.

Here are examples of what arguments get used with the
executables in different situations:

Without -c++
swig.exe -python -Iinclude -o
interface/interface_wrap.c interface/interface.i
cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -Iinclude
-IC:\Python24\include -IC:\Python24\PC
/Tcinterface/interface_wrap.c
/Fobuild\temp.win32-2.4\Release\interface/interface_wrap.obj

With -c++ (as command line option)
swig.exe -python -Iinclude -c++ -o
interface/interface_wrap.cpp interface/interface.i
cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -Iinclude
-IC:\Python24\include -IC:\Python24\PC
/Tpinterface/interface_wrap.cpp
/Fobuild\temp.win32-2.4\Release\interface/interface_wrap.obj

With -c++ (in swig_opts in setup.py)
swig.exe -python -Iinclude -c++ -o
interface/interface_wrap.c interface/interface.i
cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -Iinclude
-IC:\Python24\include -IC:\Python24\PC
/Tcinterface/interface_wrap.c
/Fobuild\temp.win32-2.4\Release\interface/interface_wrap.obj

With -c++ (in swig_opts in setup.py with patch applied)
swig.exe -python -Iinclude -c++ -o
interface/interface_wrap.cpp interface/interface.i
cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -Iinclude
-IC:\Python24\include -IC:\Python24\PC
/Tpinterface/interface_wrap.cpp
/Fobuild\temp.win32-2.4\Release\interface/interface_wrap.obj

----------------------------------------------------------------------

Comment By: Mark Howson (fremen)
Date: 2007-03-23 13:45

Message:
Logged In: YES 
user_id=35093
Originator: NO

Problem still exists as of 23/03/07 in Python 2.5, patch appears to be
correct solution.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1479255&group_id=5470


More information about the Patches mailing list