lit/LitConfig.py: Add the new method getToolsPath(dir,paths,tools).
authorNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 9 Feb 2011 04:19:15 +0000 (04:19 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 9 Feb 2011 04:19:15 +0000 (04:19 +0000)
It seeks tools(eg. [cmp, grep, sed]) in same directory, to be sane.

It seeks "bash" only in the directory found at last time. Or bash would be insane (against other tools).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125175 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit/LitConfig.py

index 43ed6f1a1f7c4c1a76e27c01792515e93def7536..7ca1b9c4c6340366ce0b5bf095e437649321d766 100644 (file)
@@ -85,6 +85,22 @@ class LitConfig:
 
         return self.bashPath
 
+    def getToolsPath(self, dir, paths, tools):
+        import os, Util
+        if dir is not None and os.path.isabs(dir) and os.path.isdir(dir):
+            if not Util.checkToolsPath(dir, tools):
+                return None
+        else:
+            dir = Util.whichTools(tools, paths)
+
+        # bash
+        self.bashPath = Util.which('bash', dir)
+        if self.bashPath is None:
+            self.warning("Unable to find 'bash.exe'.")
+            self.bashPath = ''
+
+        return dir
+
     def _write_message(self, kind, message):
         import inspect, os, sys