3 from xml
.dom
import minidom
5 from interface
import get_interface
9 print "Usage: injector PROG INTERFACE [ARGS]"
10 print "PROG is a relative path inside an implementation of INTERFACE. Eg:"
11 print "injector bin/myprog /uri/0install/site/myprog.xml --help"
14 interface
= sys
.argv
[2]
15 prog_args
= sys
.argv
[3:]
16 interactive
= bool(os
.environ
.get('INJECTOR_INTERACTIVE', None))
18 interface
= os
.path
.abspath(interface
)
20 if not interface
.startswith('/'):
21 print "Interface must be an absolute pathname (starting with /)"
24 if not os
.path
.exists(interface
):
25 print "Interface file '%s' not found" % interface
28 #print "Looking for an implementation of", interface
30 iface
= get_interface(interface
)
34 policy
= gui
.InteractivePolicy()
36 from policy
import Policy
39 selection
= policy
.choose_best(iface
)
41 run
.execute(selection
, iface
, prog
, prog_args
)