summaryrefslogtreecommitdiff
path: root/doc/examples
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-07-02 18:12:12 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2007-07-02 18:12:12 +0200
commit31d5080d3a42a410581a3c5e31551035ce510cea (patch)
tree424984026aa2ea19e4c338da33aaf67ab7fd4a07 /doc/examples
parentda5b9bcdf772358322d4e05a46cf6eb843d9afaa (diff)
parent5a05be08148871001206ae60b01ed88514189817 (diff)
downloadpython-apt-31d5080d3a42a410581a3c5e31551035ce510cea.tar.gz
* python/package.py:
- added Record class that can be accessed like a dictionary and return it in candidateRecord and installedRecord (thanks to Alexander Sack for discussing this with me) * doc/examples/records.py: - added example how to use the new Records class * python/cache.py: - throw FetchCancelleException, FetchFailedException, LockFailedException exceptions when something goes wrong
Diffstat (limited to 'doc/examples')
-rwxr-xr-xdoc/examples/records.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/examples/records.py b/doc/examples/records.py
new file mode 100755
index 00000000..ef04b555
--- /dev/null
+++ b/doc/examples/records.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+
+import apt
+
+cache = apt.Cache()
+
+for pkg in cache:
+ if not pkg.candidateRecord:
+ continue
+ if pkg.candidateRecord.has_key("Task"):
+ print "Pkg %s is part of '%s'" % (pkg.name, pkg.candidateRecord["Task"].split())
+ #print pkg.candidateRecord