diff options
| author | Julian Andres Klode <jak@debian.org> | 2011-04-12 14:51:08 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2011-04-12 14:51:08 +0200 |
| commit | d206a03cc50d3c0fee56b8dbd6a915eadc7038cf (patch) | |
| tree | e196b8afc1ffa6eaa87c3e0a3a87f3342ee42d79 /apt | |
| parent | 287e27e498516dd00aba1b78aea92a12ec079886 (diff) | |
| download | python-apt-d206a03cc50d3c0fee56b8dbd6a915eadc7038cf.tar.gz | |
apt.cache: Add a fetch_archives() method (Closes: #622347)
Diffstat (limited to 'apt')
| -rw-r--r-- | apt/cache.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/apt/cache.py b/apt/cache.py index 373bb91d..339de763 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -288,6 +288,28 @@ class Cache(object): finally: os.close(lock) + def fetch_archives(self, progress=None, fetcher=None): + """Fetch the archives for all packages marked for install/upgrade. + + You can specify either an :class:`apt.progress.base.AcquireProgress()` + object for the parameter *progress*, or specify an already + existing :class:`apt_pkg.Acquire` object for the parameter *fetcher*. + + The return value of the function is undefined. If an error occured, + an exception of type :class:`FetchFailedException` or + :class:`FetchCancelledException` is raised. + """ + if progress is not None and fetcher is not None: + raise ValueError("Takes a progress or a an Acquire object") + if progress is None: + progress = apt.progress.text.AcquireProgress() + if fetcher is None: + fetcher = apt_pkg.Acquire(progress) + + + return self._fetch_archives(fetcher, + apt_pkg.PackageManager(self._depcache)) + def is_virtual_package(self, pkgname): """Return whether the package is a virtual package.""" try: |
