From: benmwebb Date: Thu, 2 Apr 2009 20:05:58 +0000 (+0000) Subject: Set a SWIGVERSION construction variable, to contain the version number of the X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=08a0362ddb10d8d15ae2ebf48a7e913e8a36158c;p=scons.git Set a SWIGVERSION construction variable, to contain the version number of the SWIG program. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4083 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py index dda5be56..c7af7017 100644 --- a/src/engine/SCons/Tool/swig.py +++ b/src/engine/SCons/Tool/swig.py @@ -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' diff --git a/src/engine/SCons/Tool/swig.xml b/src/engine/SCons/Tool/swig.xml index e17c4c68..33d3721c 100644 --- a/src/engine/SCons/Tool/swig.xml +++ b/src/engine/SCons/Tool/swig.xml @@ -19,6 +19,7 @@ SWIGINCPREFIX SWIGINCSUFFIX SWIGCOM SWIGPATH +SWIGVERSION SWIGCOMSTR @@ -203,3 +204,9 @@ env = Environment(SWIGCOM="my_swig -o $TARGET $_SWIGINCFLAGS $SORUCES") + + + +The version number of the SWIG tool. + +