diff options
author | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-05-08 16:17:50 +0100 |
---|---|---|
committer | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-07-05 14:07:43 +0100 |
commit | 3a435724a0529ccf19a66b083208a51be8c72d04 (patch) | |
tree | f62440195e2a4a01694953cfbf7fdb988bcdaec8 | |
parent | 341afb936a710a8cc95a4a84d39b90005ef4fe8c (diff) | |
download | buildstream-3a435724a0529ccf19a66b083208a51be8c72d04.tar.gz |
Sandbox.py: Add get_virtual_directory and get_virtual_toplevel_directory
-rw-r--r-- | buildstream/sandbox/sandbox.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/buildstream/sandbox/sandbox.py b/buildstream/sandbox/sandbox.py index 90b80af2a..68e6b13b2 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 ._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 |