summaryrefslogtreecommitdiff
path: root/apt/cache.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-07-02 16:46:35 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-07-02 16:46:35 +0200
commit465b19e6ae3c6daeee0841d38ac93e0c19991c13 (patch)
treefe7105c64632ccc9dc22520b6d70a18d5342c97b /apt/cache.py
parent5a6c646ceffab7ce58106eccdccf884b6d332d58 (diff)
parentdd86db9ddb22b43867b5b4dc211f4440dec7aa6a (diff)
downloadpython-apt-465b19e6ae3c6daeee0841d38ac93e0c19991c13.tar.gz
* merged lp:~kiwinote/python-apt/merge-gdebi-changes, this port the
DebPackage class fixes from gdebi into python-apt so that gdebi can use the class from python-apt directly * apt/debfile.py: - check if the debfiles provides are in conflict with the systems packages * tests/test_debs/*.deb, tests/test_debfile.py: - add automatic test based on the test debs from gdebi
Diffstat (limited to 'apt/cache.py')
-rw-r--r--apt/cache.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/apt/cache.py b/apt/cache.py
index 3962bb4f..26532c76 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -120,6 +120,7 @@ class Cache(object):
"""
if progress is None:
progress = apt.progress.base.OpProgress()
+ self.op_progress = progress
self._run_callbacks("cache_pre_open")
self._cache = apt_pkg.Cache(progress)
@@ -288,21 +289,28 @@ class Cache(object):
else:
return bool(pkg.has_provides and not pkg.has_versions)
- def get_providing_packages(self, virtual, candidate_only=True):
- """Return a list of all packages providing a virtual package.
+ def get_providing_packages(self, pkgname, candidate_only=True,
+ include_nonvirtual=False):
+ """Return a list of all packages providing a package.
Return a list of packages which provide the virtual package of the
- specified name. If 'candidate_only' is False, return all packages
- with at least one version providing the virtual package. Otherwise,
- return only those packages where the candidate version provides
- the virtual package.
+ specified name.
+
+ If 'candidate_only' is False, return all packages with at
+ least one version providing the virtual package. Otherwise,
+ return only those packages where the candidate version
+ provides the virtual package.
+
+ If 'include_nonvirtual' is True then it will search for all
+ packages providing pkgname, even if pkgname is not itself
+ a virtual pkg.
"""
providers = set()
get_candidate_ver = self._depcache.get_candidate_ver
try:
- vp = self._cache[virtual]
- if vp.has_versions:
+ vp = self._cache[pkgname]
+ if vp.has_versions and not include_nonvirtual:
return list(providers)
except KeyError:
return list(providers)