Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
add component identity
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Krayl committed Dec 10, 2020
1 parent 017804a commit 9c816c8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion bindings-python/gci/componentmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ class SourceIdentity(ArtifactIdentity):
pass


@dc(frozen=True)
class ComponentIdentity:
name: str
version: str


class Artifact:
'''
base class for ComponentReference, Resource, Source
Expand Down Expand Up @@ -200,7 +206,7 @@ def identity(self, peers: typing.Sequence['Artifact']):
if not peers:
return identity

if len(identity) > 1: # special-case-handling not required if there are additional-id-attrs
if len(identity) > 1: # special-case-handling not required if there are additional-id-attrs
return identity

# check whether there are collissions
Expand Down Expand Up @@ -285,6 +291,9 @@ def current_repository_ctx(self):
return None
return self.repositoryContexts[-1]

def identity(self):
return ComponentIdentity(name=self.name, version=self.version)


@dc
class ComponentDescriptor:
Expand Down

0 comments on commit 9c816c8

Please sign in to comment.