summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-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