diff options
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index d9f543bc60..ba50801ae9 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -26,6 +26,7 @@ import logging | |||
26 | import bb | 26 | import bb |
27 | import bb.msg | 27 | import bb.msg |
28 | from commands import getstatusoutput | 28 | from commands import getstatusoutput |
29 | from contextlib import contextmanager | ||
29 | 30 | ||
30 | logger = logging.getLogger("BitBake.Util") | 31 | logger = logging.getLogger("BitBake.Util") |
31 | 32 | ||
@@ -398,6 +399,18 @@ def simple_exec(code, context): | |||
398 | def better_eval(source, locals): | 399 | def better_eval(source, locals): |
399 | return eval(source, _context, locals) | 400 | return eval(source, _context, locals) |
400 | 401 | ||
402 | @contextmanager | ||
403 | def fileslocked(files): | ||
404 | locks = [] | ||
405 | if files: | ||
406 | for lockfile in files: | ||
407 | locks.append(bb.utils.lockfile(lock)) | ||
408 | |||
409 | yield | ||
410 | |||
411 | for lock in locks: | ||
412 | bb.utils.unlockfile(lock) | ||
413 | |||
401 | def lockfile(name): | 414 | def lockfile(name): |
402 | """ | 415 | """ |
403 | Use the file fn as a lock file, return when the lock has been acquired. | 416 | Use the file fn as a lock file, return when the lock has been acquired. |