| Home | Trees | Indices | Help |
|
|---|
|
|
1 """
2 The B{0install download} command-line interface.
3 """
4
5 # Copyright (C) 2011, Thomas Leonard
6 # See the README file for details, or visit http://0install.net.
7
8 import sys
9
10 from zeroinstall import _
11 from zeroinstall.cmd import UsageError, select
12 from zeroinstall.injector import model
13 from zeroinstall.support import tasks
14
15 syntax = "URI"
16
18 select.add_options(parser)
19 parser.add_option("", "--show", help=_("show where components are installed"), action='store_true')
20
22 """@type config: L{zeroinstall.injector.config.Config}
23 @type args: [str]"""
24 if len(args) != 1:
25 raise UsageError()
26
27 app = config.app_mgr.lookup_app(args[0], missing_ok = True)
28 if app is not None:
29 sels = app.get_selections()
30
31 r = app.get_requirements()
32 do_select = r.parse_update_options(options)
33 iface_uri = sels.interface
34 else:
35 iface_uri = model.canonical_iface_uri(args[0])
36 do_select = True
37
38 if do_select or options.gui:
39 sels = select.get_selections(config, options, iface_uri,
40 select_only = False, download_only = True, test_callback = None)
41 if not sels:
42 sys.exit(1) # Aborted by user
43 else:
44 dl = app.download_selections(sels)
45 if dl:
46 tasks.wait_for_blocker(dl)
47 tasks.check(dl)
48
49 if options.xml:
50 select.show_xml(sels)
51 if options.show:
52 select.show_human(sels, config.stores)
53 if app is not None and do_select:
54 print(_("(use '0install update' to save the new parameters)"))
55
56 complete = select.complete
57
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Mar 26 18:14:10 2013 | http://epydoc.sourceforge.net |