summaryrefslogtreecommitdiffstats
path: root/doc/examples/indexfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/indexfile.py')
-rw-r--r--doc/examples/indexfile.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/examples/indexfile.py b/doc/examples/indexfile.py
new file mode 100644
index 0000000..34ea94e
--- /dev/null
+++ b/doc/examples/indexfile.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python3
+
+import apt_pkg
+
+apt_pkg.init()
+
+sources = apt_pkg.SourceList()
+sources.read_main_list()
+
+cache = apt_pkg.Cache()
+depcache = apt_pkg.DepCache(cache)
+pkg = cache["libimlib2"]
+cand = depcache.get_candidate_ver(pkg)
+for f, i in cand.file_list:
+ index = sources.find_index(f)
+ print(index)
+ if index:
+ print(index.size)
+ print(index.is_trusted)
+ print(index.exists)
+ print(index.has_packages)
+ print(index.archive_uri("some/path"))