From 685a659656d670acb0d606f8e91c8984d47c98b5 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Thu, 29 Nov 2007 23:37:53 -0600 Subject: Add "which" path searching functionality to pactest Signed-off-by: Aaron Griffin --- pactest/util.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pactest') diff --git a/pactest/util.py b/pactest/util.py index 99d71e55..72777ca0 100755 --- a/pactest/util.py +++ b/pactest/util.py @@ -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: -- cgit v1.2.3-70-g09d2