diff options
author | Tristan van Berkom <tristan@codethink.co.uk> | 2020-08-30 18:41:48 +0900 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2020-08-30 17:25:07 +0000 |
commit | b758505b6f1d82d839cee4b870a7fa5a8ce7422b (patch) | |
tree | 9b49ecb988c018e64b88691282edfc11d860cf1a /src/buildstream/_artifactelement.py | |
parent | fd80d4903eb28845ca9a67d5730254d93dbd0c24 (diff) | |
download | buildstream-b758505b6f1d82d839cee4b870a7fa5a8ce7422b.tar.gz |
Remove unused Scope argument from artifact name related APIs.tristan/artifact-dependency-names
Additionally, this reverts terminology back to calling these "artifact names",
and not "artifact refs", which is a terminology which crept in from various
underlying implementations.
Summary of changes:
* _artifact.py:
- get_dependency_refs() renamed to get_dependency_artifact_names()
- get_dependency_artifact_names() loses the Scope argument
- Consequently, a huge and needless XXX comment is removed
* _artifactelement.py:
- _new_from_artifact_ref() renamed to _new_from_artifact_name()
- get_dependency_refs() renamed to get_dependency_artifact_names()
- get_dependency_artifact_names() loses the Scope argument
* _project.py:
- Now call _new_from_artifact_name()
- Removes a legacy XXX comment which is not particularly relevant
* element.py:
- __get_dependency_refs() renamed to __get_dependency_artifact_names()
- Adapt __get_last_build_artifact() to updated API names.
Diffstat (limited to 'src/buildstream/_artifactelement.py')
-rw-r--r-- | src/buildstream/_artifactelement.py | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/buildstream/_artifactelement.py b/src/buildstream/_artifactelement.py index 44e52ea90..53a1ff72f 100644 --- a/src/buildstream/_artifactelement.py +++ b/src/buildstream/_artifactelement.py @@ -24,7 +24,6 @@ from . import _cachekey from ._exceptions import ArtifactElementError from ._loader import LoadElement from .node import Node -from .types import Scope if TYPE_CHECKING: from typing import Dict @@ -54,10 +53,10 @@ class ArtifactElement(Element): super().__init__(context, project, load_element, None) - # _new_from_artifact_ref(): + # _new_from_artifact_name(): # # Recursively instantiate a new ArtifactElement instance, and its - # dependencies from an artifact ref + # dependencies from an artifact name # # Args: # ref (String): The artifact ref @@ -68,7 +67,7 @@ class ArtifactElement(Element): # (ArtifactElement): A newly created Element instance # @classmethod - def _new_from_artifact_ref(cls, ref, context, task=None): + def _new_from_artifact_name(cls, ref, context, task=None): if ref in cls.__instantiated_artifacts: return cls.__instantiated_artifacts[ref] @@ -79,8 +78,8 @@ class ArtifactElement(Element): artifact_element._initialize_state() cls.__instantiated_artifacts[ref] = artifact_element - for dep_ref in artifact_element.get_dependency_refs(Scope.BUILD): - dependency = ArtifactElement._new_from_artifact_ref(dep_ref, context, task) + for dep_ref in artifact_element.get_dependency_artifact_names(): + dependency = ArtifactElement._new_from_artifact_name(dep_ref, context, task) artifact_element._add_build_dependency(dependency) return artifact_element @@ -112,19 +111,16 @@ class ArtifactElement(Element): def preflight(self): pass - # get_dependency_refs() + # get_dependency_artifact_names() # - # Obtain the refs of a particular scope of dependencies - # - # Args: - # scope (Scope): The scope of dependencies for which we want to obtain the refs + # Retrieve the artifact names of all of the dependencies in Scope.BUILD # # Returns: # (list [str]): A list of artifact refs # - def get_dependency_refs(self, scope=Scope.BUILD): + def get_dependency_artifact_names(self): artifact = self._get_artifact() - return artifact.get_dependency_refs(deps=scope) + return artifact.get_dependency_artifact_names() # configure_sandbox() # |