diff options
author | Richard Purdie <richard@openedhand.com> | 2007-08-12 23:06:49 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2007-08-12 23:06:49 +0000 |
commit | ce800d3aea333919302a490838906983c18fe54d (patch) | |
tree | 14754c6d6de07f47a6f917b4d4d0e9bf52468beb /bitbake/lib/bb/__init__.py | |
parent | fc136f0b4c9f6c0bed18fb565f5c83d041abdd39 (diff) | |
download | poky-ce800d3aea333919302a490838906983c18fe54d.tar.gz |
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
Diffstat (limited to 'bitbake/lib/bb/__init__.py')
-rw-r--r-- | bitbake/lib/bb/__init__.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py index e601eda469..1bfecc49ec 100644 --- a/bitbake/lib/bb/__init__.py +++ b/bitbake/lib/bb/__init__.py | |||
@@ -345,14 +345,20 @@ def encodeurl(decoded): | |||
345 | ####################################################################### | 345 | ####################################################################### |
346 | 346 | ||
347 | def which(path, item, direction = 0): | 347 | def which(path, item, direction = 0): |
348 | """Useful function for locating a file in a PATH""" | 348 | """ |
349 | found = "" | 349 | Locate a file in a PATH |
350 | """ | ||
351 | |||
352 | paths = (path or "").split(':') | ||
353 | if direction != 0: | ||
354 | paths.reverse() | ||
355 | |||
350 | for p in (path or "").split(':'): | 356 | for p in (path or "").split(':'): |
351 | if os.path.exists(os.path.join(p, item)): | 357 | next = os.path.join(p, item) |
352 | found = os.path.join(p, item) | 358 | if os.path.exists(next): |
353 | if direction == 0: | 359 | return next |
354 | break | 360 | |
355 | return found | 361 | return "" |
356 | 362 | ||
357 | ####################################################################### | 363 | ####################################################################### |
358 | 364 | ||