diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-04-09 16:29:58 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-04-09 10:25:36 +0000 |
commit | 26f7f0b86534d6acc72b8a416f944c49d2da49eb (patch) | |
tree | 3b2bbfefba5aa9ba87a30f678680958854c0ff15 /buildstream | |
parent | 66cf08faf8aa10ecaf183604754bb314381d71a7 (diff) | |
download | buildstream-26f7f0b86534d6acc72b8a416f944c49d2da49eb.tar.gz |
element.py: Factored out pointless extra Element._workspaced() method
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_frontend/widget.py | 2 | ||||
-rw-r--r-- | buildstream/element.py | 17 |
2 files changed, 6 insertions, 13 deletions
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py index 53509b31c..a1e8cc3ac 100644 --- a/buildstream/_frontend/widget.py +++ b/buildstream/_frontend/widget.py @@ -702,7 +702,7 @@ class LogLine(Widget): if "%{workspaced" in format_: line = p.fmt_subst( line, 'workspaced', - '(workspaced)' if element._workspaced() else '', fg='yellow') + '(workspaced)' if element._get_workspace() else '', fg='yellow') # Workspace-dirs if "%{workspace-dirs" in format_: diff --git a/buildstream/element.py b/buildstream/element.py index c4a534065..0f68bf606 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -505,7 +505,7 @@ class Element(Plugin): # of any files created by our dependencies since the last # successful build. to_update = None - if self._workspaced() and old_dep_keys: + if self._get_workspace() and old_dep_keys: dep._assert_cached() if dep.name in old_dep_keys: @@ -867,7 +867,7 @@ class Element(Plugin): self._update_state() - if self._workspaced() and self._cached(): + if self._get_workspace() and self._cached(): project = self._get_project() key = self._get_cache_key() workspace = self._get_workspace() @@ -1178,7 +1178,7 @@ class Element(Plugin): e.name: e._get_cache_key() for e in self.dependencies(Scope.BUILD) } workspaced_dependencies = { - e.name: e._workspaced() for e in self.dependencies(Scope.BUILD) + e.name: True if e._get_workspace() else False for e in self.dependencies(Scope.BUILD) } meta = { 'keys': { @@ -1186,7 +1186,7 @@ class Element(Plugin): 'weak': self._get_cache_key(_KeyStrength.WEAK), 'dependencies': dependencies }, - 'workspaced': self._workspaced(), + 'workspaced': True if self._get_workspace() else False, 'workspaced_dependencies': workspaced_dependencies } _yaml.dump(_yaml.node_sanitize(meta), os.path.join(metadir, 'artifact.yaml')) @@ -1336,13 +1336,6 @@ class Element(Plugin): project = self._get_project() return project.workspaces.get_workspace(self.name) - # Whether this element has a source that is workspaced. - # - def _workspaced(self): - if self._get_workspace(): - return True - return False - # _workspaced_artifact(): # # Returns whether the current artifact is workspaced. @@ -1516,7 +1509,7 @@ class Element(Plugin): return sandbox.run(argv, flags, env=environment) def _can_build_incrementally(self): - return self._workspaced() and self.__artifacts.can_diff() + return self._get_workspace() and self.__artifacts.can_diff() # _stage_sources_in_sandbox(): # |