From e2f321d6035dd0c8eba7467e71fea17150784157 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 31 Jan 2017 22:41:45 +0100 Subject: [PATCH] expose name/version from metadata class Signed-off-by: Igor Gnatenko --- cargodeps.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cargodeps.py b/cargodeps.py index f1c6db3..9ec20ed 100755 --- a/cargodeps.py +++ b/cargodeps.py @@ -31,6 +31,8 @@ class Dependency(object): class Metadata(object): def __init__(self, path): + self.name = None + self.version = None self._provides = [] self._requires = [] self._conflicts = [] @@ -83,8 +85,8 @@ class Metadata(object): def _parse_metadata(self, metadata): md = metadata["packages"][0] - name = md["name"] - version = semver.SpecItem("={}".format(md["version"])) + self.name = md["name"] + self.version = semver.SpecItem("={}".format(md["version"])) # Provides self._provides = [Dependency(name, version)]