summaryrefslogtreecommitdiff
path: root/engine/SCons/Tool/swig.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-11-16 05:58:13 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-11-16 05:58:13 +0100
commit6a570afd28bccdb118edde36488ba9834494d6c7 (patch)
tree162100eb912a704d570559c85484ae6d6943fc76 /engine/SCons/Tool/swig.py
parent72c39ad485d174c2e8e1fef34b8e9e392a94458a (diff)
Imported Upstream version 2.4.1upstream/2.4.1
Diffstat (limited to 'engine/SCons/Tool/swig.py')
-rw-r--r--engine/SCons/Tool/swig.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/engine/SCons/Tool/swig.py b/engine/SCons/Tool/swig.py
index 83cd315..74c5a8e 100644
--- a/engine/SCons/Tool/swig.py
+++ b/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'