summaryrefslogtreecommitdiffstats
path: root/doc/source/examples/update-print-uris.py
blob: 02981f8cee0b7116b38e6b2577fb070c6ea59efc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/python3
"""Print out the URIs of all indexes files.

This behaves somewhat like apt-get --print-uris update."""
import apt_pkg


def main():
    apt_pkg.init_config()
    apt_pkg.init_system()
    acquire = apt_pkg.Acquire()
    slist = apt_pkg.SourceList()
    # Read the list
    slist.read_main_list()
    # Add all indexes to the fetcher.
    slist.get_indexes(acquire, True)

    # Now print the URI of every item.
    for item in acquire.items:
        print(item.desc_uri)


if __name__ == "__main__":
    main()