| Home | Trees | Indices | Help |
|
|---|
|
|
1 """
2 The B{0install add} command-line interface.
3 """
4
5 # Copyright (C) 2012, Thomas Leonard
6 # See the README file for details, or visit http://0install.net.
7
8 from __future__ import print_function
9
10 import sys
11
12 from zeroinstall import _
13 from zeroinstall.cmd import UsageError, select
14 from zeroinstall.injector import model, requirements
15
16 syntax = "PET-NAME INTERFACE"
17
20
22 """@type args: [str]"""
23 if len(args) != 2:
24 raise UsageError()
25
26 pet_name = args[0]
27 iface_uri = model.canonical_iface_uri(args[1])
28
29 sels = select.get_selections(config, options, iface_uri, select_only = False, download_only = True, test_callback = None)
30 if not sels:
31 sys.exit(1) # Aborted by user
32
33 root_feed = config.iface_cache.get_feed(iface_uri)
34 if root_feed:
35 target = root_feed.get_replaced_by()
36 if target is not None:
37 print(_("Warning: interface {old} has been replaced by {new}".format(old = iface_uri, new = target)))
38
39 r = requirements.Requirements(iface_uri)
40 r.parse_options(options)
41
42 app = config.app_mgr.create_app(pet_name, r)
43 app.set_selections(sels)
44 app.integrate_shell(pet_name)
45
52
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Mar 26 18:14:09 2013 | http://epydoc.sourceforge.net |