summaryrefslogtreecommitdiffstats
path: root/pactest
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2007-11-30 06:37:53 +0100
committerDan McGee <dan@archlinux.org>2007-12-11 06:06:03 +0100
commit685a659656d670acb0d606f8e91c8984d47c98b5 (patch)
treebf07decc45ca3283a278e4507ac4a22ac6262671 /pactest
parent9558639d8009483fbf422b138d020745986f82f1 (diff)
downloadpacman-685a659656d670acb0d606f8e91c8984d47c98b5.tar.gz
pacman-685a659656d670acb0d606f8e91c8984d47c98b5.tar.xz
Add "which" path searching functionality to pactest
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'pactest')
-rwxr-xr-xpactest/util.py8
1 files changed, 8 insertions, 0 deletions
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: