diff options
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 | ||