[llvm-commits] [llvm] r125174 - /llvm/trunk/utils/lit/lit/Util.py
NAKAMURA Takumi
geek4civic at gmail.com
Tue Feb 8 20:19:06 PST 2011
Author: chapuni
Date: Tue Feb 8 22:19:06 2011
New Revision: 125174
URL: http://llvm.org/viewvc/llvm-project?rev=125174&view=rev
Log:
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.
Modified:
llvm/trunk/utils/lit/lit/Util.py
Modified: llvm/trunk/utils/lit/lit/Util.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/Util.py?rev=125174&r1=125173&r2=125174&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/Util.py (original)
+++ llvm/trunk/utils/lit/lit/Util.py Tue Feb 8 22:19:06 2011
@@ -75,6 +75,18 @@
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
More information about the llvm-commits
mailing list