diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-02 14:50:52 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-02 14:50:52 +0200 |
| commit | 03ce5718b828ade3940a8dd6c57a639f0d853cfc (patch) | |
| tree | 7ca419cb5d6eee52c3302757ee8d40fb40a3b1cb /apt/cache.py | |
| parent | a90b26aad2824d4bd224586cdf14c0ad21059ac3 (diff) | |
| parent | 0c4bbfa36f36d42cc3d700e58d531e05ba898e0e (diff) | |
| download | python-apt-03ce5718b828ade3940a8dd6c57a639f0d853cfc.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
Diffstat (limited to 'apt/cache.py')
| -rw-r--r-- | apt/cache.py | 24 |
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) |
