summaryrefslogtreecommitdiff
path: root/apt
diff options
context:
space:
mode:
authorSebastian Heinlein <renate@unstable.virtual>2009-04-10 22:42:37 +0200
committerSebastian Heinlein <renate@unstable.virtual>2009-04-10 22:42:37 +0200
commit6f9513ed04d9357ca55895d32a312c0538a8dda2 (patch)
treec2f3a61cae776590135ea00438c5388dfe067a14 /apt
parent75eeb9186bd254f60964d2ec9e70c45ecc92a247 (diff)
downloadpython-apt-6f9513ed04d9357ca55895d32a312c0538a8dda2.tar.gz
Add Package.get_version() which returns a Version instance for the given version string or None
Diffstat (limited to 'apt')
-rw-r--r--apt/package.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/apt/package.py b/apt/package.py
index 9afe1674..1dfabd46 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -872,6 +872,13 @@ class Package(object):
"""
return [Version(self, ver) for ver in self._pkg.VersionList]
+ def get_version(self, version):
+ """Get the Version instance matching the given version string."""
+ for ver in self.versions:
+ if ver.version == version:
+ return ver
+ return None
+
# depcache actions
def markKeep(self):