This is an automated email from the ASF dual-hosted git repository. juergbi pushed a commit to branch jbilleter/digest-environment in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 0ae61d1d4a3decfb97a9ebcb682f74460f62b886 Author: Jürg Billeter <[email protected]> AuthorDate: Fri Jul 18 10:31:03 2025 +0200 sandbox.py: Make `create_subsandbox()` private --- src/buildstream/buildelement.py | 2 +- src/buildstream/sandbox/sandbox.py | 37 +++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/buildstream/buildelement.py b/src/buildstream/buildelement.py index 1b6c0bf0e..ef4827371 100644 --- a/src/buildstream/buildelement.py +++ b/src/buildstream/buildelement.py @@ -313,7 +313,7 @@ class BuildElement(Element): sorted_envs = sorted(self.__digest_environment) for digest_variable in sorted_envs: element_list = [element for element, _ in self.__digest_environment[digest_variable]] - subsandbox = sandbox.create_subsandbox() + subsandbox = sandbox._create_subsandbox() self.stage_dependency_artifacts(subsandbox, element_list) digest = subsandbox.get_virtual_directory()._get_digest() env[digest_variable] = "{}/{}".format(digest.hash, digest.size_bytes) diff --git a/src/buildstream/sandbox/sandbox.py b/src/buildstream/sandbox/sandbox.py index 6483792d4..29a3e31bf 100644 --- a/src/buildstream/sandbox/sandbox.py +++ b/src/buildstream/sandbox/sandbox.py @@ -269,24 +269,6 @@ class Sandbox: batch.execute() - def create_subsandbox(self, **kwargs): - """Create an empty sandbox - - This allows an element to use a secondary sandbox for manipulating artifacts - that does not affect the build sandbox - """ - - sub = Sandbox( - self.__context, - self.__project, - parent=self, - stdout=self.__stdout, - stderr=self.__stderr, - config=self.__config, - ) - self.__subsandboxes.append(sub) - return sub - ##################################################### # Abstract Methods for Sandbox implementations # ##################################################### @@ -581,6 +563,25 @@ class Sandbox: def _disable_run(self): self.__allow_run = False + # _create_subsandbox() + # + # Create an empty sandbox + # + # This allows an element to use a secondary sandbox for manipulating artifacts + # that does not affect the build sandbox. + # + def _create_subsandbox(self, **kwargs): + sub = Sandbox( + self.__context, + self.__project, + parent=self, + stdout=self.__stdout, + stderr=self.__stderr, + config=self.__config, + ) + self.__subsandboxes.append(sub) + return sub + def _get_subsandboxes(self): return self.__subsandboxes
