mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 18:49:32 +02:00
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:
@@ -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 ""
|
||||
|
||||
#######################################################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user