summaryrefslogtreecommitdiff
path: root/buildstream/_project.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-16 18:26:05 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-16 18:26:05 +0900
commitcd90fbde079ac42e930c45fcab509d49205fe54c (patch)
treefcac2d2304d943ecc07eca1f8d51359e47acaec9 /buildstream/_project.py
parentca2331c3f314ff53428b5ca9c8c2efc9d2dbd7cc (diff)
downloadbuildstream-cd90fbde079ac42e930c45fcab509d49205fe54c.tar.gz
Clean up element/source instantiation code paths.
This removes the extra `kind` parameter from all of the related codepaths, it is redundant since the `kind` attribute is already stored on the MetaElement and MetaSource objects.
Diffstat (limited to 'buildstream/_project.py')
-rw-r--r--buildstream/_project.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/buildstream/_project.py b/buildstream/_project.py
index e71bdf0f1..745289c2b 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -171,16 +171,15 @@ class Project():
# Instantiate and return an element
#
# Args:
- # kind (str): The kind of Element to create
# artifacts (ArtifactCache): The artifact cache
- # meta (object): The loaded MetaElement
+ # meta (MetaElement): The loaded MetaElement
#
# Returns:
# (Element): A newly created Element object of the appropriate kind
#
- def create_element(self, kind, artifacts, meta):
- element = self._element_factory.create(kind, self._context, self, artifacts, meta)
- version = self._element_format_versions.get(kind, 0)
+ def create_element(self, artifacts, meta):
+ element = self._element_factory.create(self._context, self, artifacts, meta)
+ version = self._element_format_versions.get(meta.kind, 0)
self._assert_plugin_format(element, version)
return element
@@ -189,15 +188,14 @@ class Project():
# Instantiate and return a Source
#
# Args:
- # kind (str): The kind of Source to create
- # meta (object): The loaded MetaSource
+ # meta (MetaSource): The loaded MetaSource
#
# Returns:
# (Source): A newly created Source object of the appropriate kind
#
- def create_source(self, kind, meta):
- source = self._source_factory.create(kind, self._context, self, meta)
- version = self._source_format_versions.get(kind, 0)
+ def create_source(self, meta):
+ source = self._source_factory.create(self._context, self, meta)
+ version = self._source_format_versions.get(meta.kind, 0)
self._assert_plugin_format(source, version)
return source