[Numpy-svn] r8663 - trunk/numpy/distutils/command
numpy-svn at scipy.org
numpy-svn at scipy.org
Wed Aug 25 04:41:58 EDT 2010
Author: pearu
Date: 2010-08-25 03:41:58 -0500 (Wed, 25 Aug 2010)
New Revision: 8663
Modified:
trunk/numpy/distutils/command/build_src.py
Log:
Fix swig target extension when swig target is not defined by the .i file but should be c++.
Modified: trunk/numpy/distutils/command/build_src.py
===================================================================
--- trunk/numpy/distutils/command/build_src.py 2010-08-25 07:22:40 UTC (rev 8662)
+++ trunk/numpy/distutils/command/build_src.py 2010-08-25 08:41:58 UTC (rev 8663)
@@ -656,6 +656,8 @@
for source in sources:
(base, ext) = os.path.splitext(source)
if ext == '.i': # SWIG interface file
+ # the code below assumes that the sources list
+ # contains not more than one .i SWIG interface file
if self.inplace:
target_dir = os.path.dirname(base)
py_target_dir = self.ext_target_dir
@@ -671,10 +673,16 @@
if typ is None:
typ = get_swig_target(source)
is_cpp = typ=='c++'
- if is_cpp: target_ext = '.cpp'
+ if is_cpp:
+ target_ext = '.cpp'
else:
typ2 = get_swig_target(source)
- if typ!=typ2:
+ if typ2 is None:
+ log.warn('source %r does not define swig target, assuming %s swig target' \
+ % (source, typ))
+ if is_cpp:
+ target_ext = '.cpp'
+ elif typ!=typ2:
log.warn('expected %r but source %r defines %r swig target' \
% (typ, source, typ2))
if typ2=='c++':
@@ -750,7 +758,7 @@
def get_swig_target(source):
f = open(source,'r')
- result = 'c'
+ result = None
line = f.readline()
if _has_cpp_header(line):
result = 'c++'
More information about the Numpy-svn
mailing list