File: cache-pkgfile.py

package info (click to toggle)
python-apt 0.7.100.1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,748 kB
  • ctags: 1,919
  • sloc: cpp: 8,937; python: 5,750; makefile: 89; sh: 9
file content (29 lines) | stat: -rw-r--r-- 870 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python
import apt_pkg


def main():
    """Example for PackageFile()"""
    apt_pkg.init()
    cache = apt_pkg.Cache()
    for pkgfile in cache.file_list:
        print 'Package-File:', pkgfile.filename
        print 'Index-Type:', pkgfile.index_type # 'Debian Package Index'
        if pkgfile.not_source:
            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.not_automatic:
            # The system won't be updated automatically (eg. experimental)
            print 'Automatic: No'
        else:
            print 'Automatic: Yes'
        print

if __name__ == '__main__':
    main()