diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:49:44 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:49:44 +0100 |
| commit | 9e13c9a669959cac7ff4983f36eeede8039cb6eb (patch) | |
| tree | 3778f55d63c20956cbb7ddee790d6ef69d26e267 /doc/source/examples/cache-pkgfile.py | |
| parent | c906abf5f25479483041636813117c48556f389b (diff) | |
| parent | 85839f4f241c99f9e4ebb0a6a8847a2d433f1160 (diff) | |
| download | python-apt-9e13c9a669959cac7ff4983f36eeede8039cb6eb.tar.gz | |
merge from the debian branch
Diffstat (limited to 'doc/source/examples/cache-pkgfile.py')
| -rw-r--r-- | doc/source/examples/cache-pkgfile.py | 29 |
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() |
