Message ID | 20220830155909.662089-1-JPEWhacker@gmail.com |
---|---|
State | New |
Headers | show |
Series | [bitbake-devel] utils: Pass lock argument in fileslocked | expand |
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index b8b90df8d3..92d44c5260 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -431,12 +431,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
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. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> --- bitbake/lib/bb/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)