summaryrefslogtreecommitdiff
path: root/doc/examples/indexfile.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-01-04 23:27:33 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2006-01-04 23:27:33 +0000
commit170c310e75aa0bc417cb67f6e560fdaab482d72e (patch)
tree7d83888cf413bccbd80b4e5388761c0f66fa20bb /doc/examples/indexfile.py
parent5462bd26c53ed6cddfec2d22a85034db2c786b51 (diff)
downloadpython-apt-170c310e75aa0bc417cb67f6e560fdaab482d72e.tar.gz
* added support for pkgIndexFile
Diffstat (limited to 'doc/examples/indexfile.py')
-rw-r--r--doc/examples/indexfile.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/examples/indexfile.py b/doc/examples/indexfile.py
new file mode 100644
index 00000000..e7f81e61
--- /dev/null
+++ b/doc/examples/indexfile.py
@@ -0,0 +1,20 @@
+
+import apt_pkg
+
+apt_pkg.init()
+
+sources = apt_pkg.GetPkgSourceList()
+sources.ReadMainList()
+
+cache = apt_pkg.GetCache()
+depcache = apt_pkg.GetDepCache(cache)
+pkg = cache["bzr"]
+cand = depcache.GetCandidateVer(pkg)
+for (f,i) in cand.FileList:
+ index = sources.FindIndex(f)
+ print index
+ if index:
+ print index.Size
+ print index.IsTrusted
+ print index.Exists
+ print index.HasPackages