summaryrefslogtreecommitdiffstats
path: root/doc/examples/sources.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/sources.py')
-rw-r--r--doc/examples/sources.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/examples/sources.py b/doc/examples/sources.py
new file mode 100644
index 0000000..b467b7d
--- /dev/null
+++ b/doc/examples/sources.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python3
+
+import apt_pkg
+
+apt_pkg.init()
+
+# cache = apt_pkg.Cache()
+# sources = apt_pkg.SourceRecords(cache)
+
+sources = apt_pkg.SourceRecords()
+sources.restart()
+while sources.lookup("hello"):
+ print(
+ sources.package,
+ sources.version,
+ sources.maintainer,
+ sources.section,
+ repr(sources.binaries),
+ )
+ print(sources.files)
+ print(sources.index.archive_uri(sources.files[0][2]))