aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2011-02-09 04:19:06 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2011-02-09 04:19:06 +0000
commitdf944f1f83420b44e3a41d379c361b797c827b42 (patch)
treecb8bf2ab59375362b866a0bdec8b2eda3e29eba7 /utils
parentb656a11c7050f5cad6f8792d2a6ee29823d1c14d (diff)
downloadexternal_llvm-df944f1f83420b44e3a41d379c361b797c827b42.zip
external_llvm-df944f1f83420b44e3a41d379c361b797c827b42.tar.gz
external_llvm-df944f1f83420b44e3a41d379c361b797c827b42.tar.bz2
lit/Util.py: Add two functions, checkToolsPath(dir,tools) and whichTools(tools,paths).
checkToolsPath(dir,tools): return True if "dir" contains all "tools". whichTools(tools,paths): return a directory that contains all "tools" in "paths". Or return None when all "tools" were not met. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125174 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/lit/lit/Util.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/lit/lit/Util.py b/utils/lit/lit/Util.py
index 414b714..ad4adf2 100644
--- a/utils/lit/lit/Util.py
+++ b/utils/lit/lit/Util.py
@@ -75,6 +75,18 @@ def which(command, paths = None):
return None
+def checkToolsPath(dir, tools):
+ for tool in tools:
+ if not os.path.exists(os.path.join(dir, tool)):
+ return False;
+ return True;
+
+def whichTools(tools, paths):
+ for path in paths.split(os.pathsep):
+ if checkToolsPath(path, tools):
+ return path
+ return None
+
def printHistogram(items, title = 'Items'):
import itertools, math