diff options
author | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-08-13 19:01:00 +0900 |
---|---|---|
committer | Tristan van Berkom <tristan@codethink.co.uk> | 2020-10-01 13:27:30 +0900 |
commit | 751c80d4938b7c3a798d056134f58844242939b3 (patch) | |
tree | a31bd535be946b3032d22b6296a49b735ba5e2b1 /src/buildstream/types.py | |
parent | 348108d933be748727ee8aec861ecd5c168db72e (diff) | |
download | buildstream-751c80d4938b7c3a798d056134f58844242939b3.tar.gz |
Refactor: Lazily instantiate ProvenanceInformation objectstristan/lazy-provenance
As a rule, throughout the codebase we should not be using internal
ProvenanceInformation objects in our APIs, but rather Node objects.
This is because ProvenanceInformation is generated on the fly from
a Node object, and it is needlessly expensive to instantiate one before
it is absolutely needed.
This patch unilaterally fixes the codebase to pass `provenance_node`
Node objects around as arguments rather than `provenance` ProvenanceInformation
objects.
Diffstat (limited to 'src/buildstream/types.py')
-rw-r--r-- | src/buildstream/types.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/buildstream/types.py b/src/buildstream/types.py index 48dd5de6d..a5cf7afb8 100644 --- a/src/buildstream/types.py +++ b/src/buildstream/types.py @@ -280,14 +280,14 @@ class _PipelineSelection(FastEnum): # # Args: # project (Project): The project instance -# provenance (ProvenanceInformation): The provenance information, if any +# provenance_node (Node): The provenance information, if any # duplicates (list): List of project descriptions which declared this project as a duplicate # internal (list): List of project descriptions which declared this project as internal # class _ProjectInformation: - def __init__(self, project, provenance, duplicates, internal): + def __init__(self, project, provenance_node, duplicates, internal): self.project = project - self.provenance = provenance + self.provenance = provenance_node.get_provenance() if provenance_node else None self.duplicates = duplicates self.internal = internal |