diff options
| -rw-r--r-- | apt/cache.py | 22 | ||||
| -rw-r--r-- | debian/changelog | 1 |
2 files changed, 23 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: diff --git a/debian/changelog b/debian/changelog index f89de6de..bd87c411 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,7 @@ python-apt (0.8.0~exp2) UNRELEASED; urgency=low * doc/examples: Add example on how to get architecture names (LP: #194374) * apt_pkg: Fix unsigned/long-vs-int issues (LP: #610820) * apt.cache: Document that update() may need an open() (Closes: #622342) + * apt.cache: Add a fetch_archives() method (Closes: #622347) -- Julian Andres Klode <jak@debian.org> Wed, 06 Apr 2011 09:46:52 +0200 |
