From 45c2d7045d61b6d572faeebae73096311c16fdeb Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Tue, 20 Jan 2009 14:21:54 +0000 Subject: Detect implicit command dependencies even when the command is quoted. --- src/CHANGES.txt | 3 +++ src/engine/SCons/Action.py | 9 ++++++++- test/Batch/action-changed.py | 3 ++- test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 56b216e..aa4543e 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -17,6 +17,9 @@ RELEASE X.X.X - XXX - Add sources for files whose targets don't exist in $CHANGED_SOURCES. + - Detect implicit dependencies on commands even when the command is + quoted. + RELEASE 1.2.0.d20090113 - Tue, 13 Jan 2009 02:50:30 -0800 diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index e106e74..96a48a7 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -102,6 +102,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import cPickle import dis import os +import re import string import sys import subprocess @@ -154,6 +155,8 @@ else: i = i+1 return string.join(result, '') +strip_quotes = re.compile('^[\'"](.*)[\'"]$') + def _callable_contents(obj): """Return the signature contents of a callable Python object. @@ -822,7 +825,11 @@ class CommandAction(_ActionAction): res = [] for cmd_line in cmd_list: if cmd_line: - d = env.WhereIs(str(cmd_line[0])) + d = str(cmd_line[0]) + m = strip_quotes.match(d) + if m: + d = m.group(1) + d = env.WhereIs(d) if d: res.append(env.fs.File(d)) return res diff --git a/test/Batch/action-changed.py b/test/Batch/action-changed.py index d50087c..935bce8 100644 --- a/test/Batch/action-changed.py +++ b/test/Batch/action-changed.py @@ -58,7 +58,8 @@ os.chmod(test.workpath('build.py'), 0755) test.write('SConstruct', """ env = Environment() -bb = Action('%s $CHANGED_TARGETS -- $CHANGED_SOURCES', +env.PrependENVPath('PATHEXT', '.PY') +bb = Action(r'"%s" $CHANGED_TARGETS -- $CHANGED_SOURCES', batch_key=True, targets='CHANGED_TARGETS') env['BUILDERS']['Batch'] = Builder(action=bb) diff --git a/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py b/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py index 47acc2f..e5021da 100644 --- a/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py +++ b/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py @@ -88,6 +88,7 @@ env1.BuildFile('file1.out', 'file.in') envNone.BuildFile('fileNone.out', 'file.in') envFalse.BuildFile('fileFalse.out', 'file.in') envTrue.BuildFile('fileTrue.out', 'file.in') +envTrue.BuildFile('fileQuote.out', 'file.in', BUILD_PY='"build.py"') """ % locals()) @@ -104,6 +105,7 @@ test.must_match('file1.out', expect_none % 'file1.out') test.must_match('fileNone.out', expect_none % 'fileNone.out') test.must_match('fileFalse.out', expect_none % 'fileFalse.out') test.must_match('fileTrue.out', expect_none % 'fileTrue.out') +test.must_match('fileQuote.out', expect_none % 'fileQuote.out') @@ -120,6 +122,7 @@ test.must_match('file1.out', expect_extra % 'file1.out') test.must_match('fileNone.out', expect_none % 'fileNone.out') test.must_match('fileFalse.out', expect_none % 'fileFalse.out') test.must_match('fileTrue.out', expect_extra % 'fileTrue.out') +test.must_match('fileQuote.out', expect_extra % 'fileQuote.out') test.pass_test() -- cgit v0.12