diff options
| author | Michael Vogt <egon@bottom> | 2006-07-25 13:18:15 +0200 |
|---|---|---|
| committer | Michael Vogt <egon@bottom> | 2006-07-25 13:18:15 +0200 |
| commit | d27dee5e4d80f10a8a37cf59e855484c4016e6b1 (patch) | |
| tree | ba77e5230b59ed4a0f55d3d796bd7808b5b12727 /doc | |
| parent | e491706947931c8d67b42a37c9de6f3a08098ac4 (diff) | |
| parent | 71022104cf64547ba54029555799d72e6fb8027f (diff) | |
| download | python-apt-d27dee5e4d80f10a8a37cf59e855484c4016e6b1.tar.gz | |
* merged from mainline
Diffstat (limited to 'doc')
| -rwxr-xr-x | doc/examples/print_uris.py | 22 | ||||
| -rw-r--r-- | doc/examples/sources.py | 2 |
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("") |
