From 42bdce0b2f45607a400b279487e823bea4fe9c70 Mon Sep 17 00:00:00 2001 From: Jim MacArthur Date: Tue, 8 May 2018 16:17:50 +0100 Subject: sandbox.py: Add function to get virtual directory. --- buildstream/sandbox/sandbox.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'buildstream/sandbox/sandbox.py') diff --git a/buildstream/sandbox/sandbox.py b/buildstream/sandbox/sandbox.py index 90b80af2a..80a309c0c 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,20 @@ 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 set_environment(self, environment): """Sets the environment variables for the sandbox -- cgit v1.2.1