This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch jmac/googlecas_and_virtual_directories_1 in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 92cc9a1dede46f64c6f1ed150bba700e9e9aa11f Author: Jim MacArthur <[email protected]> AuthorDate: Tue May 8 16:17:50 2018 +0100 Sandbox.py: Add get_virtual_directory and get_virtual_toplevel_directory --- buildstream/sandbox/sandbox.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/buildstream/sandbox/sandbox.py b/buildstream/sandbox/sandbox.py index c99bbaf..979367b 100644 --- a/buildstream/sandbox/sandbox.py +++ b/buildstream/sandbox/sandbox.py @@ -32,6 +32,7 @@ See also: :ref:`sandboxing`. import os from .._exceptions import ImplError, BstError +from ._filebaseddirectory import FileBasedDirectory class SandboxFlags(): @@ -123,6 +124,33 @@ class Sandbox(): else: raise BstError("You can't use get_directory") + def get_virtual_directory(self): + """Fetches the sandbox root directory + + The root directory is where artifacts for the base + runtime environment should be staged. Only works if + BST_VIRTUAL_DIRECTORY is not set. + + Returns: + (str): The sandbox root directory + + """ + # For now, just create a new Directory every time we're asked + return FileBasedDirectory(self._root) + + def get_virtual_toplevel_directory(self): + """Fetches the sandbox's toplevel directory + + The toplevel directory contains 'root', 'scratch' and later + 'artifact' where output is copied to. + + Returns: + (str): The sandbox toplevel directory + + """ + # For now, just create a new Directory every time we're asked + return FileBasedDirectory(self.__directory) + def set_environment(self, environment): """Sets the environment variables for the sandbox
