summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-04-21 15:58:46 +0200
committerJulian Andres Klode <jak@debian.org>2010-04-21 15:58:46 +0200
commit6b8d60e6ee5bb3f140f65c0f25e7d463eb18834d (patch)
tree0bf7da5b179c7c97301fe3ad1bc097993ae4c5e5
parent906ba788c824ff4f2bc2b00ecb44d0743159c904 (diff)
downloadpython-apt-6b8d60e6ee5bb3f140f65c0f25e7d463eb18834d.tar.gz
python/cache.cc: Add Package.has_provides to see which packages are provided at least once.
-rw-r--r--debian/changelog3
-rw-r--r--python/cache.cc8
2 files changed, 10 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index c79ede07..7326ed09 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,7 +14,8 @@ 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.
+ - Add Package.has_versions to see which packages have at least one version,
+ and Package.has_provides for provides.
- Add rich compare methods to the Version object.
* python/generic.cc:
- Fix a memory leak when using old attribute names.
diff --git a/python/cache.cc b/python/cache.cc
index 03c453a1..4d7c347a 100644
--- a/python/cache.cc
+++ b/python/cache.cc
@@ -539,6 +539,12 @@ static PyObject *PackageGetHasVersions(PyObject *Self,void*)
return PyBool_FromLong(Pkg.VersionList().end() == false);
}
+static PyObject *PackageGetHasProvides(PyObject *Self,void*)
+{
+ pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(Self);
+ return PyBool_FromLong(Pkg.ProvidesList().end() == false);
+}
+
static PyObject *PackageGetCurrentVer(PyObject *Self,void*)
{
pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(Self);
@@ -592,6 +598,8 @@ static PyGetSetDef PackageGetSet[] = {
"The version of the package currently installed or None."},
{"has_versions",PackageGetHasVersions,0,
"Whether the package has at least one version in the cache."},
+ {"has_provides",PackageGetHasProvides,0,
+ "Whether the package is provided by at least one other package."},
{}
};