mirror of
https://github.com/moparisthebest/pacman
synced 2025-02-28 09:21:53 -05:00
Add "which" path searching functionality to pactest
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
This commit is contained in:
parent
9558639d80
commit
685a659656
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user