Set a SWIGVERSION construction variable, to contain the version number of the
authorbenmwebb <benmwebb@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 2 Apr 2009 20:05:58 +0000 (20:05 +0000)
committerbenmwebb <benmwebb@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 2 Apr 2009 20:05:58 +0000 (20:05 +0000)
SWIG program.

git-svn-id: http://scons.tigris.org/svn/scons/trunk@4083 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Tool/swig.py
src/engine/SCons/Tool/swig.xml

index dda5be56098997bec75c619b103f7c6e6f35f94c..c7af70174ab3f66f2a5fb54cc37595189ff21e40 100644 (file)
@@ -119,6 +119,13 @@ def _swigEmitter(target, source, env):
             target.extend(java_files)
     return (target, source)
 
+def _get_swig_version(env):
+    """Run the SWIG command line tool to get and return the version number"""
+    out = os.popen(env['SWIG'] + ' -version').read()
+    match = re.search(r'SWIG Version\s+(\S+)$', out, re.MULTILINE)
+    if match:
+        return match.group(1)
+
 def generate(env):
     """Add Builders and construction variables for swig to an Environment."""
     c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
@@ -139,6 +146,7 @@ def generate(env):
     java_file.add_emitter('.i', _swigEmitter)
 
     env['SWIG']              = 'swig'
+    env['SWIGVERSION']       = _get_swig_version(env)
     env['SWIGFLAGS']         = SCons.Util.CLVar('')
     env['SWIGDIRECTORSUFFIX'] = '_wrap.h'
     env['SWIGCFILESUFFIX']   = '_wrap$CFILESUFFIX'
index e17c4c682e66f2fa254aaa57a37ea91d046c601b..33d3721c0a1559bb8186c8fb0f62e49cd251b2c9 100644 (file)
@@ -19,6 +19,7 @@ SWIGINCPREFIX
 SWIGINCSUFFIX
 SWIGCOM
 SWIGPATH
+SWIGVERSION
 </sets>
 <uses>
 SWIGCOMSTR
@@ -203,3 +204,9 @@ env = Environment(SWIGCOM="my_swig -o $TARGET $_SWIGINCFLAGS $SORUCES")
 </example>
 </summary>
 </cvar>
+
+<cvar name="SWIGVERSION">
+<summary>
+The version number of the SWIG tool.
+</summary>
+</cvar>