Detect implicit command dependencies even when the command is quoted.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 20 Jan 2009 14:21:54 +0000 (14:21 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 20 Jan 2009 14:21:54 +0000 (14:21 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@3911 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Action.py
test/Batch/action-changed.py
test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py

index 56b216e8f4816950da6fcf26ecc4336a26fcc80a..aa4543eb639c637af88b15a6ef1fa6cfd86b707f 100644 (file)
@@ -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
index e106e74e587d91688fea0e6ca9925ff13df7d389..96a48a761ffbe8f80f0e8874e1f2db802a545c40 100644 (file)
@@ -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
index d50087c32b10fd05ad95df6c82fac60f4e3fa179..935bce891d7a78eaaaa26d3086053d9fa0d4fff6 100644 (file)
@@ -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)
index 47acc2f6968eba6ff5147f67b5e42754375d6329..e5021dac56078dea86e5ad0df06c23fd56754c9f 100644 (file)
@@ -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()