summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-06-09 17:38:18 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-06-09 17:38:18 +0200
commit0bb531dbcf27b40861467b831b120fc8b257e8ff (patch)
treebbbda3be325306bbbe56b22aca25984bee710ddb
parent52ae9a181314398e4dc4996d1409e99b9bdbbf7e (diff)
downloadpython-apt-0bb531dbcf27b40861467b831b120fc8b257e8ff.tar.gz
* changelog updated
* prints_uris.py example added
-rw-r--r--debian/changelog10
-rwxr-xr-xdoc/examples/print_uris.py22
-rw-r--r--doc/examples/sources.py2
3 files changed, 32 insertions, 2 deletions
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 <mvo@debian.org> 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("")