mirror of
https://git.yoctoproject.org/poky
synced 2026-04-18 03:32:13 +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: 048d682b031644fb9f0d41a489bacb873aa27bd7) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
bc294f9573
commit
87377eacc0
@@ -421,12 +421,14 @@ def better_eval(source, locals, extraglobals = None):
|
||||
return eval(source, ctx, locals)
|
||||
|
||||
@contextmanager
|
||||
def fileslocked(files):
|
||||
def fileslocked(files, *args, **kwargs):
|
||||
"""Context manager for locking and unlocking file locks."""
|
||||
locks = []
|
||||
if 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:
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user