diff options
| author | Sebastian Heinlein <renate@unstable.virtual> | 2009-04-10 22:42:37 +0200 |
|---|---|---|
| committer | Sebastian Heinlein <renate@unstable.virtual> | 2009-04-10 22:42:37 +0200 |
| commit | 6f9513ed04d9357ca55895d32a312c0538a8dda2 (patch) | |
| tree | c2f3a61cae776590135ea00438c5388dfe067a14 /apt | |
| parent | 75eeb9186bd254f60964d2ec9e70c45ecc92a247 (diff) | |
| download | python-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.py | 7 |
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): |
