summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-06-05 19:41:10 +0200
committerJulian Andres Klode <jak@debian.org>2009-06-05 19:41:10 +0200
commit4e929ba7cf9d1d3a29c32785c69ba2b85df1133a (patch)
treec5daa7bd54072a1a5142fed83c1bc69b3c1b081e
parent4ced65ec744e29019e7890eb6f505387940e74d5 (diff)
parent6f9513ed04d9357ca55895d32a312c0538a8dda2 (diff)
downloadpython-apt-4e929ba7cf9d1d3a29c32785c69ba2b85df1133a.tar.gz
apt/package.py: Add Package.get_version() which returns a Version instance
for the given version string or None (Closes: #523998)
-rw-r--r--apt/package.py7
-rw-r--r--debian/changelog4
2 files changed, 11 insertions, 0 deletions
diff --git a/apt/package.py b/apt/package.py
index 48d14595..0dcc8b74 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -994,6 +994,13 @@ class Package(object):
"""
return [Version(self, ver) for ver in self._pkg.version_list]
+ 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 mark_keep(self):
diff --git a/debian/changelog b/debian/changelog
index 6150632c..61ec1527 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,10 @@ python-apt (0.7.91) UNRELEASED; urgency=low
* debian/python-apt.doc-base: register the documentation with the
doc-base system (Closes: #525134)
+ [ Sebastian Heinlein ]
+ * apt/package.py: Add Package.get_version() which returns a Version instance
+ for the given version string or None (Closes: #523998)
+
-- Julian Andres Klode <jak@debian.org> Fri, 05 Jun 2009 19:36:45 +0200
python-apt (0.7.90) experimental; urgency=low