From 0bb531dbcf27b40861467b831b120fc8b257e8ff Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 9 Jun 2006 17:38:18 +0200 Subject: * changelog updated * prints_uris.py example added --- debian/changelog | 10 +++++++++- doc/examples/print_uris.py | 22 ++++++++++++++++++++++ doc/examples/sources.py | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 doc/examples/print_uris.py diff --git a/debian/changelog b/debian/changelog index 5eac06d1..a1a9858e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-apt (0.6.18) unstable; urgency=low + + * doc/examples/print_uris.py: + - added a example to show how the indexfile.ArchiveURI() can be used + with binary packages + + -- + python-apt (0.6.17) unstable; urgency=low * apt/progress.py: @@ -24,7 +32,7 @@ python-apt (0.6.17) unstable; urgency=low * python/indexfile.cc: - added ArchiveURI() method - -- + -- Michael Vogt Mon, 8 May 2006 22:34:58 +0200 python-apt (0.6.16.2) unstable; urgency=low 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("") -- cgit v1.2.3