2 The B{0install run} command-line interface.
5 # Copyright (C) 2011, Thomas Leonard
6 # See the README file for details, or visit http://0install.net.
10 from zeroinstall
import _
11 from zeroinstall
.cmd
import UsageError
, select
12 from zeroinstall
.injector
import model
16 def add_options(parser
):
17 select
.add_generic_select_options(parser
)
18 parser
.add_option("-m", "--main", help=_("name of the file to execute"))
19 parser
.add_option("-w", "--wrapper", help=_("execute program using a debugger, etc"), metavar
='COMMAND')
20 parser
.disable_interspersed_args()
22 def handle(config
, options
, args
):
25 iface_uri
= model
.canonical_iface_uri(args
[0])
28 def test_callback(sels
):
29 from zeroinstall
.injector
import run
30 return run
.test_selections(sels
, prog_args
,
34 sels
= select
.get_selections(config
, options
, iface_uri
,
35 select_only
= False, download_only
= False,
36 test_callback
= test_callback
)
38 sys
.exit(1) # Aborted by user
40 from zeroinstall
.injector
import run
41 run
.execute_selections(sels
, prog_args
, dry_run
= options
.dry_run
, main
= options
.main
, wrapper
= options
.wrapper
, stores
= config
.stores
)