From 513093cd51f95a8d014cd5436d3fff8556e10ced Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 10 Jan 2009 18:14:11 +0100 Subject: * doc/: Heavily improve documentation Complete the documentation of pkgCache, pkgDepCache, pkgCache::Package. Introduce new documentation for pkgCache::Version, pkgCache::Dependency, pkgCache::PackageFile, pkgcache::Description. There is also an example now which checks for missing dependencies. --- doc/source/examples/cache-packages.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 doc/source/examples/cache-packages.py (limited to 'doc/source/examples/cache-packages.py') diff --git a/doc/source/examples/cache-packages.py b/doc/source/examples/cache-packages.py new file mode 100644 index 00000000..1abe7cf2 --- /dev/null +++ b/doc/source/examples/cache-packages.py @@ -0,0 +1,22 @@ +#!/usr/bin/python +"""Example for packages. Print all essential and important packages""" + +import apt_pkg + + +def main(): + """Main.""" + apt_pkg.InitConfig() + apt_pkg.InitSystem() + cache = apt_pkg.GetCache() + print "Essential packages:" + for pkg in cache.Packages: + if pkg.Essential: + print " ", pkg.Name + print "Important packages:" + for pkg in cache.Packages: + if pkg.Important: + print " ", pkg.Name + +if __name__ == "__main__": + main() -- cgit v1.2.3