Add "which" path searching functionality to pactest

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
This commit is contained in:
Aaron Griffin 2007-11-29 23:37:53 -06:00 committed by Dan McGee
parent 9558639d80
commit 685a659656

View File

@ -235,6 +235,14 @@ def diffmtime(mt1, mt2):
# Miscellaneous
#
def which(filename):
path = os.environ["PATH"].split(':')
for p in path:
f = os.path.join(p, filename)
if os.access(f, os.F_OK):
return f
return None
def grep(filename, pattern):
lines = file(filename, 'r').readlines()
for line in lines: