From 5352d7bacb4f3f59c315a35e990d57fd3d52466d Mon Sep 17 00:00:00 2001 From: Tristan van Berkom Date: Wed, 2 Dec 2020 19:25:10 +0900 Subject: _stream.py: Centralize application state cleanup Instead of delegating this job to a Project instance, implement the application state cleanup directly on the Stream object. This commit also: * Removes Project.cleanup() * Reword incorrect API documentation for Element._reset_load_state() --- src/buildstream/_project.py | 8 -------- src/buildstream/_stream.py | 4 ++-- src/buildstream/element.py | 3 +-- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py index 180c23977..fd4a44732 100644 --- a/src/buildstream/_project.py +++ b/src/buildstream/_project.py @@ -485,14 +485,6 @@ class Project: self._load_second_pass() - # cleanup() - # - # Cleans up resources used loading elements - # - def cleanup(self): - # Reset the element loader state - Element._reset_load_state() - # get_default_target() # # Attempts to interpret which element the user intended to run a command on. diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index 222957c02..fc5b15211 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -111,8 +111,8 @@ class Stream: # Cleans up application state # def cleanup(self): - if self._project: - self._project.cleanup() + # Reset the element loader state + Element._reset_load_state() # set_project() # diff --git a/src/buildstream/element.py b/src/buildstream/element.py index efec5e714..3ac201d66 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -1194,8 +1194,7 @@ class Element(Plugin): # _reset_load_state() # - # This is called by Pipeline.cleanup() and is used to - # reset the loader state between multiple sessions. + # This is used to reset the loader state across multiple load sessions. # @classmethod def _reset_load_state(cls): -- cgit v1.2.1