bitbake: Sync with upstream 1.8 branch for fixes

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2484 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie
2007-08-12 23:06:49 +00:00
parent fc136f0b4c
commit ce800d3aea
6 changed files with 58 additions and 17 deletions

View File

@@ -345,14 +345,20 @@ def encodeurl(decoded):
#######################################################################
def which(path, item, direction = 0):
"""Useful function for locating a file in a PATH"""
found = ""
"""
Locate a file in a PATH
"""
paths = (path or "").split(':')
if direction != 0:
paths.reverse()
for p in (path or "").split(':'):
if os.path.exists(os.path.join(p, item)):
found = os.path.join(p, item)
if direction == 0:
break
return found
next = os.path.join(p, item)
if os.path.exists(next):
return next
return ""
#######################################################################