diff options
| author | Julian Andres Klode <jak@debian.org> | 2010-04-21 15:46:33 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2010-04-21 15:46:33 +0200 |
| commit | 55122aa21c2947aacd07554da57bc323afcd730e (patch) | |
| tree | 086b212edb225028f146074c15789b3c5a02da69 | |
| parent | c57524a3efe3f26bfc7aee7ca80bf6640b23cd02 (diff) | |
| download | python-apt-55122aa21c2947aacd07554da57bc323afcd730e.tar.gz | |
Add Package.has_versions to see which packages have at least one version.
| -rw-r--r-- | debian/changelog | 1 | ||||
| -rw-r--r-- | python/cache.cc | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 0b02662f..911c68d9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,7 @@ python-apt (0.7.94.3) UNRELEASED; urgency=low * python/cache.cc: - Check that 2nd argument to Cache.update() really is a SourceList object. - Fix PackageFile.not_automatic to use NotAutomatic instead of NotSource. + - Add Package.has_versions to see which packages have at least one version. * python/generic.cc: - Fix a memory leak when using old attribute names. - Map ArchiveURI property to archive_uri diff --git a/python/cache.cc b/python/cache.cc index ac9832e2..7cfaffbf 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -532,6 +532,13 @@ static PyObject *PackageGetVersionList(PyObject *Self,void*) } return List; } + +static PyObject *PackageGetHasVersions(PyObject *Self,void*) +{ + pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(Self); + return PyBool_FromLong(Pkg.VersionList().end() == false); +} + static PyObject *PackageGetCurrentVer(PyObject *Self,void*) { pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(Self); @@ -583,6 +590,8 @@ static PyGetSetDef PackageGetSet[] = { "A list of all apt_pkg.Version objects for this package."}, {"current_ver",PackageGetCurrentVer,0, "The version of the package currently installed or None."}, + {"has_versions",PackageGetHasVersions,0, + "Whether the package has at least one version in the cache."}, {} }; |
