summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMichael Vogt <egon@bottom>2006-07-25 13:18:15 +0200
committerMichael Vogt <egon@bottom>2006-07-25 13:18:15 +0200
commitd27dee5e4d80f10a8a37cf59e855484c4016e6b1 (patch)
treeba77e5230b59ed4a0f55d3d796bd7808b5b12727 /doc
parente491706947931c8d67b42a37c9de6f3a08098ac4 (diff)
parent71022104cf64547ba54029555799d72e6fb8027f (diff)
downloadpython-apt-d27dee5e4d80f10a8a37cf59e855484c4016e6b1.tar.gz
* merged from mainline
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/examples/print_uris.py22
-rw-r--r--doc/examples/sources.py2
2 files changed, 23 insertions, 1 deletions
diff --git a/doc/examples/print_uris.py b/doc/examples/print_uris.py
new file mode 100755
index 00000000..c8a64223
--- /dev/null
+++ b/doc/examples/print_uris.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+#
+# a example that prints the URIs of all upgradable packages
+#
+
+import apt
+import apt_pkg
+
+
+cache = apt.Cache()
+upgradable = filter(lambda p: p.isUpgradable, cache)
+
+
+for pkg in upgradable:
+ pkg._lookupRecord(True)
+ path = apt_pkg.ParseSection(pkg._records.Record)["Filename"]
+ cand = pkg._depcache.GetCandidateVer(pkg._pkg)
+ for (packagefile,i) in cand.FileList:
+ indexfile = cache._list.FindIndex(packagefile)
+ if indexfile:
+ uri = indexfile.ArchiveURI(path)
+ print uri
diff --git a/doc/examples/sources.py b/doc/examples/sources.py
index 78913523..c12c6f15 100644
--- a/doc/examples/sources.py
+++ b/doc/examples/sources.py
@@ -11,5 +11,5 @@ sources = apt_pkg.GetPkgSrcRecords()
sources.Restart()
while sources.Lookup('hello'):
print sources.Package, sources.Version, sources.Maintainer, sources.Section, `sources.Binaries`
- #print sources.Files
+ print sources.Files
print sources.Index.ArchiveURI("")