summaryrefslogtreecommitdiff
path: root/doc/source/examples/cache-pkgfile.py
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-01-10 18:14:11 +0100
committerJulian Andres Klode <jak@debian.org>2009-01-10 18:14:11 +0100
commit513093cd51f95a8d014cd5436d3fff8556e10ced (patch)
tree2d136e8f1824224a1af3c81b7984081b54699e6a /doc/source/examples/cache-pkgfile.py
parent291e82879b70ed0b9f4628bebeff1fd1e047a7a3 (diff)
downloadpython-apt-513093cd51f95a8d014cd5436d3fff8556e10ced.tar.gz
* 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.
Diffstat (limited to 'doc/source/examples/cache-pkgfile.py')
-rw-r--r--doc/source/examples/cache-pkgfile.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/source/examples/cache-pkgfile.py b/doc/source/examples/cache-pkgfile.py
new file mode 100644
index 00000000..f25975d3
--- /dev/null
+++ b/doc/source/examples/cache-pkgfile.py
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+import apt_pkg
+
+
+def main():
+ """Example for PackageFile()"""
+ apt_pkg.init()
+ cache = apt_pkg.GetCache()
+ for pkgfile in cache.FileList:
+ print 'Package-File:', pkgfile.FileName
+ print 'Index-Type:', pkgfile.IndexType # 'Debian Package Index'
+ if pkgfile.NotSource:
+ print 'Source: None'
+ else:
+ if pkgfile.Site:
+ # There is a source, and a site, print the site
+ print 'Source:', pkgfile.Site
+ else:
+ # It seems to be a local repository
+ print 'Source: Local package file'
+ if pkgfile.NotAutomatic:
+ # The system won't be updated automatically (eg. experimental)
+ print 'Automatic: No'
+ else:
+ print 'Automatic: Yes'
+ print
+
+if __name__ == '__main__':
+ main()