From bf020b8b55739672ce5335850db921277539327e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 18 Nov 2005 11:54:43 +0000 Subject: * support for the pkgAcquire::ItemIterator added --- doc/examples/acquire.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index 98b70ab0..f920e5e9 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -11,8 +11,11 @@ recs = apt_pkg.GetPkgRecords(cache) list = apt_pkg.GetPkgSourceList() list.ReadMainList() -os.mkdir("/tmp/pyapt-test") -os.mkdir("/tmp/pyapt-test/partial") +try: + os.mkdir("/tmp/pyapt-test") + os.mkdir("/tmp/pyapt-test/partial") +except OSError: + pass apt_pkg.Config.Set("Dir::Cache::archives","/tmp/pyapt-test") pkg = cache["3ddesktop"] @@ -28,5 +31,15 @@ print fetcher pm.GetArchives(fetcher,list,recs) -fetcher.Run() +for item in fetcher.Items: + print "%s -> %s:\n Status: %s Complete: %s IsTrusted: %s" % (item.DescURI, + item.DestFile, + item.Status, + item.Complete, + item.IsTrusted) + print + + +res = fetcher.Run() +print "fetcher.Run() returned: %s" % res -- cgit v1.2.3