From cc2ee79c082884e03ccba7693afdaf1e05f43acc Mon Sep 17 00:00:00 2001 From: Darius Makovsky Date: Mon, 7 Oct 2019 18:06:48 +0100 Subject: workspace.py: raise AssertionError on init_workspace --- src/buildstream/plugins/sources/workspace.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/buildstream/plugins/sources/workspace.py b/src/buildstream/plugins/sources/workspace.py index 8dbcc6218..9cc524f89 100644 --- a/src/buildstream/plugins/sources/workspace.py +++ b/src/buildstream/plugins/sources/workspace.py @@ -105,14 +105,11 @@ class WorkspaceSource(Source): self.__digest = self.__cas_dir._get_digest().hash return (self.path, self.__digest) + # init_workspace() + # + # Raises AssertionError: existing workspaces should not be reinitialized def init_workspace(self, directory: Directory) -> None: - # for each source held by the workspace we must call init_workspace - # those sources may override `init_workspace` expecting str or Directory - # and this will need to be extracted from the directory passed to this method - assert isinstance(directory, Directory) - directory = directory.external_directory - for source in self.get_element_sources(): - source._init_workspace(directory) + raise AssertionError('Attempting to re-open an existing workspace') def get_consistency(self): # always return cached state -- cgit v1.2.1