All of lore.kernel.org
 help / color / mirror / Atom feed
* [bitbake-devel][PATCH] utils: Pass lock argument in fileslocked
@ 2022-08-30 15:59 Joshua Watt
  0 siblings, 0 replies; only message in thread
From: Joshua Watt @ 2022-08-30 15:59 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Joshua Watt

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(-)

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
-- 
2.33.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-30 15:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30 15:59 [bitbake-devel][PATCH] utils: Pass lock argument in fileslocked Joshua Watt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.