diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-10-25 14:57:38 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-10-25 14:57:38 +0100 |
| commit | 2ccb7545bb8c869f5f6192569a47a7522b6fbc83 (patch) | |
| tree | 2bcd30bdda346154cca1bc6d32e4904bafab3d2f /doc/source/examples | |
| parent | a7217b885beff13462bbb793eac42d28c53752f8 (diff) | |
| download | python-apt-2ccb7545bb8c869f5f6192569a47a7522b6fbc83.tar.gz | |
Add a tutorial on how to do things which are possible with apt-get,
like apt-get --print-uris update (cf. #551164).
Diffstat (limited to 'doc/source/examples')
| -rw-r--r-- | doc/source/examples/update-print-uris.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/source/examples/update-print-uris.py b/doc/source/examples/update-print-uris.py new file mode 100644 index 00000000..f078cdc5 --- /dev/null +++ b/doc/source/examples/update-print-uris.py @@ -0,0 +1,22 @@ +#!/usr/bin/python +"""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() |
