Skip to content
Snippets Groups Projects
Commit a37c4f52 authored by Jim MacArthur's avatar Jim MacArthur
Browse files

Sandbox.py: Rename __root to _root.

This is to allow to allow its use by subclasses.

Since access to get_directories is now blocked for some plugins,
and the subclasses of Sandbox do not have configuration defined
by YAML files, they need another way to get at the root directory.
parent 4221c19c
No related branches found
No related tags found
No related merge requests found
......@@ -90,7 +90,7 @@ class SandboxChroot(Sandbox):
# Nonetheless a better solution could perhaps be found.
rootfs = stack.enter_context(utils._tempdir(dir='/var/run/buildstream'))
stack.enter_context(self.create_devices(self.get_directory(), flags))
stack.enter_context(self.create_devices(self._root, flags))
stack.enter_context(self.mount_dirs(rootfs, flags, stdout, stderr))
if flags & SandboxFlags.INTERACTIVE:
......
......@@ -97,11 +97,12 @@ class Sandbox():
self.__stdout = kwargs['stdout']
self.__stderr = kwargs['stderr']
# Setup the directories
# Setup the directories. Root should be available to subclasses, hence
# being single-underscore. The others are private to this class.
self._root = os.path.join(directory, 'root')
self.__directory = directory
self.__root = os.path.join(self.__directory, 'root')
self.__scratch = os.path.join(self.__directory, 'scratch')
for directory_ in [self.__root, self.__scratch]:
for directory_ in [self._root, self.__scratch]:
os.makedirs(directory_, exist_ok=True)
def get_directory(self):
......@@ -116,7 +117,7 @@ class Sandbox():
"""
if self.__allow_real_directory:
return self.__root
return self._root
else:
raise BstError("You can't use get_directory")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment