summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Tool/swig.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Tool/swig.py')
-rw-r--r--src/engine/SCons/Tool/swig.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py
index 83cd315..74c5a8e 100644
--- a/src/engine/SCons/Tool/swig.py
+++ b/src/engine/SCons/Tool/swig.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/swig.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
+__revision__ = "src/engine/SCons/Tool/swig.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os.path
import re
@@ -44,6 +44,8 @@ import SCons.Tool
import SCons.Util
import SCons.Node
+swigs = [ 'swig', 'swig3.0', 'swig2.0' ]
+
SwigAction = SCons.Action.Action('$SWIGCOM', '$SWIGCOMSTR')
def swigSuffixEmitter(env, source):
@@ -128,9 +130,10 @@ def _swigEmitter(target, source, env):
target.extend(java_files)
return (target, source)
-def _get_swig_version(env):
+def _get_swig_version(env, swig):
"""Run the SWIG command line tool to get and return the version number"""
- pipe = SCons.Action._subproc(env, [env['SWIG'], '-version'],
+ swig = env.subst(swig)
+ pipe = SCons.Action._subproc(env, SCons.Util.CLVar(swig) + ['-version'],
stdin = 'devnull',
stderr = 'devnull',
stdout = subprocess.PIPE)
@@ -160,8 +163,9 @@ def generate(env):
java_file.add_action('.i', SwigAction)
java_file.add_emitter('.i', _swigEmitter)
- env['SWIG'] = 'swig'
- env['SWIGVERSION'] = _get_swig_version(env)
+ if 'SWIG' not in env:
+ env['SWIG'] = env.Detect(swigs) or swigs[0]
+ env['SWIGVERSION'] = _get_swig_version(env, env['SWIG'])
env['SWIGFLAGS'] = SCons.Util.CLVar('')
env['SWIGDIRECTORSUFFIX'] = '_wrap.h'
env['SWIGCFILESUFFIX'] = '_wrap$CFILESUFFIX'