summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-06-28 15:10:22 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2007-06-28 15:10:22 +0200
commit39910144460cafcc27d69026fd680fc8bd19c447 (patch)
tree82bed87b6cdfbbde1d925af90218b0be4ff68518 /doc
parenta1de071656261bb3e488c373cc8b6e9e62bf1a6c (diff)
downloadpython-apt-39910144460cafcc27d69026fd680fc8bd19c447.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
Diffstat (limited to 'doc')
-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