mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
bitbake: utils: Pass lock argument in fileslocked
Pass additional arguments in the fileslocked() context manager to the underlying lockfile() function. This allows the context manager to be used for any types of locks (non-blocking, shared, etc.) that the lockfile() function supports. (Bitbake rev: 7a8eb8da8e8495051e174721062da08e06168024) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
de284c467a
commit
79cc8584e6
|
@ -431,12 +431,14 @@ def better_eval(source, locals, extraglobals = None):
|
||||||
return eval(source, ctx, locals)
|
return eval(source, ctx, locals)
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def fileslocked(files):
|
def fileslocked(files, *args, **kwargs):
|
||||||
"""Context manager for locking and unlocking file locks."""
|
"""Context manager for locking and unlocking file locks."""
|
||||||
locks = []
|
locks = []
|
||||||
if files:
|
if files:
|
||||||
for lockfile in files:
|
for lockfile in files:
|
||||||
locks.append(bb.utils.lockfile(lockfile))
|
l = bb.utils.lockfile(lockfile, *args, **kwargs)
|
||||||
|
if l is not None:
|
||||||
|
locks.append(l)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
|
|
Loading…
Reference in New Issue
Block a user