Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: third_party/scons/scons-local/SCons/Tool/swig.py

Issue 20025: Update SCons to latest checkpoint release, 1.2.0.d20090113.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/scons/scons-local/SCons/Tool/swig.py
===================================================================
--- third_party/scons/scons-local/SCons/Tool/swig.py (revision 9094)
+++ third_party/scons/scons-local/SCons/Tool/swig.py (working copy)
@@ -9,7 +9,7 @@
"""
#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -31,7 +31,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/swig.py 3842 2008/12/20 22:59:52 scons"
+__revision__ = "src/engine/SCons/Tool/swig.py 3897 2009/01/13 06:45:54 scons"
import os.path
import re
@@ -51,8 +51,18 @@
return '$SWIGCFILESUFFIX'
# Match '%module test', as well as '%module(directors="1") test'
-_reModule = re.compile(r'%module(?:\s*\(.*\))?\s+(.+)')
+# Also allow for test to be quoted (SWIG permits double quotes, but not single)
+_reModule = re.compile(r'%module(\s*\(.*\))?\s+("?)(.+)\2')
+def _find_modules(src):
+ """Find all modules referenced by %module lines in `src`, a SWIG .i file.
+ Returns a list of all modules."""
+ mnames = []
+ matches = _reModule.findall(open(src).read())
+ for m in matches:
+ mnames.append(m[2])
+ return mnames
+
def _swigEmitter(target, source, env):
swigflags = env.subst("$SWIGFLAGS", target=target, source=source)
flags = SCons.Util.CLVar(swigflags)
@@ -61,12 +71,12 @@
mnames = None
if "-python" in flags and "-noproxy" not in flags:
if mnames is None:
- mnames = _reModule.findall(open(src).read())
+ mnames = _find_modules(src)
target.extend(map(lambda m, d=target[0].dir:
d.File(m + ".py"), mnames))
if "-java" in flags:
if mnames is None:
- mnames = _reModule.findall(open(src).read())
+ mnames = _find_modules(src)
java_files = map(lambda m: [m + ".java", m + "JNI.java"], mnames)
java_files = SCons.Util.flatten(java_files)
outdir = env.subst('$SWIGOUTDIR', target=target, source=source)
@@ -102,7 +112,7 @@
env['SWIGFLAGS'] = SCons.Util.CLVar('')
env['SWIGCFILESUFFIX'] = '_wrap$CFILESUFFIX'
env['SWIGCXXFILESUFFIX'] = '_wrap$CXXFILESUFFIX'
- env['_SWIGOUTDIR'] = '${"-outdir " + str(SWIGOUTDIR)}'
+ env['_SWIGOUTDIR'] = r'${"-outdir \"%s\"" % SWIGOUTDIR}'
env['SWIGPATH'] = []
env['SWIGINCPREFIX'] = '-I'
env['SWIGINCSUFFIX'] = ''
« no previous file with comments | « third_party/scons/scons-local/SCons/Tool/sunlink.py ('k') | third_party/scons/scons-local/SCons/Tool/tar.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698