This is an automated email from the ASF dual-hosted git repository. akitouni pushed a commit to branch abderrahim/nested-reapi in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 451474645502f85d8b37ad7740e45448a970bf78 Author: Jürg Billeter <j...@bitron.ch> AuthorDate: Fri Jul 18 15:16:06 2025 +0200 element.py: Add `subsandbox()` method --- src/buildstream/element.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/buildstream/element.py b/src/buildstream/element.py index ecc4de77a..a9d12fbde 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -828,6 +828,21 @@ class Element(Plugin): sandbox._clean_directory(build_root) + @contextmanager + def subsandbox(self, sandbox: "Sandbox") -> Iterator["Sandbox"]: + """A context manager for a subsandbox. + + Args: + sandbox: The main build sandbox + + This allows an element to use a secondary sandbox for manipulating + artifacts without affecting the main build sandbox. The subsandbox + is initially empty. + """ + subsandbox = sandbox._create_subsandbox() + with self.__collect_overlaps(subsandbox): + yield subsandbox + ############################################################# # Private Methods used in BuildStream # #############################################################