win32 test portability fixes (Anthony Roach)
[scons.git] / etc / TestSCons.py
index 5d4d4a09a64589d88c3018f729ffb399e40c634f..997104bc616a839309494d32ba2d2a83dd8fad31 100644 (file)
@@ -151,6 +151,20 @@ class TestSCons(TestCmd.TestCmd):
            print self.stderr()
            raise TestFailed
 
+    def detect(self, var, prog):
+        """
+        Detect a program named 'prog' by first checking  the construction 
+        variable named 'var' and finally searching the path. If either method
+        fails to detect the program, then false is returned, otherwise 
+        the programs full path is returned.
+        """
+
+        import SCons.Environment
+        try:
+            return SCons.Environment.Environment()[var] == prog and self.where_is(prog)
+        except KeyError:
+            return None
+
     def wrap_stdout(self, build_str = "", read_str = ""):
         """Wraps standard output string(s) in the normal
         "Reading ... done" and "Building ... done" strings