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 /python | |
| parent | c57524a3efe3f26bfc7aee7ca80bf6640b23cd02 (diff) | |
| download | python-apt-55122aa21c2947aacd07554da57bc323afcd730e.tar.gz | |
Add Package.has_versions to see which packages have at least one version.
Diffstat (limited to 'python')
| -rw-r--r-- | python/cache.cc | 9 |
1 files changed, 9 insertions, 0 deletions
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."}, {} }; |
