summaryrefslogtreecommitdiff
path: root/doc/examples/acquire.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/acquire.py')
-rw-r--r--doc/examples/acquire.py19
1 files changed, 16 insertions, 3 deletions
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