This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch jmac/virtual_directories_pre_rebase in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 9aa7db211c7551f97728ca13527bd3c7496511a9 Author: Jim MacArthur <jim.macart...@codethink.co.uk> AuthorDate: Tue May 8 16:17:50 2018 +0100 sandbox.py: Two functions to get virtual directories 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 90b80af..f3cab41 100644 --- a/buildstream/sandbox/sandbox.py +++ b/buildstream/sandbox/sandbox.py @@ -30,6 +30,7 @@ See also: :ref:`sandboxing`. import os from .._exceptions import ImplError, BstError +from ..storage._filebaseddirectory import FileBasedDirectory class SandboxFlags(): @@ -121,6 +122,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