Repository: SCons/scons

Issue:
IMPLICIT_COMMAND_DEPENDENCIES does not allow for 'false-like values'
`IMPLICIT_COMMAND_DEPENDENCIES` does not allow for 'false-like values', despite what the user-guide says.

https://github.com/SCons/scons/blob/master/SCons/Action.py#L971

`str(icd).lower` should actually be `str(icd).lower()`

* SCons 4.1.0 (scons-local)
* Python 3.8.5
* Ubuntu 20.04



Discussion:

Resolving patch:
diff --git a/SCons/Action.py b/SCons/Action.py
--- a/SCons/Action.py
+++ b/SCons/Action.py
@@ -968,7 +968,7 @@ def get_implicit_deps(self, target, source, env, executor=None):
         if is_String(icd) and icd[:1] == '$':
             icd = env.subst(icd)
 
-        if not icd or str(icd).lower in ('0', 'none', 'false', 'no', 'off'):
+        if not icd or str(icd).lower() in ('0', 'none', 'false', 'no', 'off'):
             return []
 
         try:
@@ -976,7 +976,7 @@ def get_implicit_deps(self, target, source, env, executor=None):
         except ValueError:
             icd_int = None
 
-        if (icd_int and icd_int > 1) or icd == 'all':
+        if (icd_int and icd_int > 1) or str(icd).lower() == 'all':
             # An integer value greater than 1 specifies the number of entries
             # to scan. "all" means to scan all.
             return self._get_implicit_deps_heavyweight(target, source, env, executor, icd_int)
diff --git a/SCons/ActionTests.py b/SCons/ActionTests.py
--- a/SCons/ActionTests.py
+++ b/SCons/ActionTests.py
@@ -1371,6 +1371,43 @@ def subst_target_source(self, strSubst, raw=0, target=[], source=[]):
         c = a.get_contents(target=t, source=s, env=env)
         assert c == b"s4 s5", c
 
+    def test_get_implicit_deps(self):
+        """Test getting the implicit dependencies of a command Action."""
+        class SpecialEnvironment(Environment):
+            def WhereIs(self, prog):
+                return prog
+            
+            class fs:
+                def File(name):
+                    return name
+
+        env = SpecialEnvironment()
+        a = SCons.Action.CommandAction([_python_, exit_py])
+        self.assertEqual(a.get_implicit_deps(target=[], source=[], env=env), [_python_])
+
+        for false_like_value in [False, 0, None, "None", "False", "0", "NONE", "FALSE", "off", "OFF", "NO", "no"]:
+            env = SpecialEnvironment(IMPLICIT_COMMAND_DEPENDENCIES=false_like_value)
+            a = SCons.Action.CommandAction([_python_, exit_py])
+            self.assertEqual(a.get_implicit_deps(target=[], source=[], env=env), [])
+
+            env = SpecialEnvironment(IMPLICIT_COMMAND_DEPENDENCIES="$SUBST_VALUE", SUBST_VALUE=false_like_value)
+            a = SCons.Action.CommandAction([_python_, exit_py])
+            self.assertEqual(a.get_implicit_deps(target=[], source=[], env=env), [])
+
+        for true_like_value in [True, 1, "True", "TRUE", "1"]:
+            env = SpecialEnvironment(IMPLICIT_COMMAND_DEPENDENCIES=true_like_value)
+            a = SCons.Action.CommandAction([_python_, exit_py])
+            self.assertEqual(a.get_implicit_deps(target=[], source=[], env=env), [_python_])
+
+            env = SpecialEnvironment(IMPLICIT_COMMAND_DEPENDENCIES="$SUBST_VALUE", SUBST_VALUE=true_like_value)
+            a = SCons.Action.CommandAction([_python_, exit_py])
+            self.assertEqual(a.get_implicit_deps(target=[], source=[], env=env), [_python_])
+
+        for all_like_Value in ["all", "ALL", 2, "2"]:
+            env = SpecialEnvironment(IMPLICIT_COMMAND_DEPENDENCIES=all_like_Value)
+            a = SCons.Action.CommandAction([_python_, exit_py])
+            self.assertEqual(a.get_implicit_deps(target=[], source=[], env=env), [_python_, exit_py])
+
 
 class CommandGeneratorActionTestCase(unittest.TestCase):
 


Test patch: