Home | Trees | Indices | Help |
|
---|
|
1 """ 2 The B{0install show} 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 os 11 12 from zeroinstall import _, SafeException 13 from zeroinstall.cmd import select, UsageError 14 from zeroinstall.injector import qdom, selections 15 16 syntax = "APP | SELECTIONS" 1719 parser.add_option("-r", "--root-uri", help=_("display just the root interface URI"), action='store_true') 20 parser.add_option("", "--xml", help=_("print selections as XML"), action='store_true')2123 if len(args) != 1: 24 raise UsageError() 25 26 app = config.app_mgr.lookup_app(args[0], missing_ok = True) 27 if app is not None: 28 sels = app.get_selections() 29 30 r = app.get_requirements() 31 32 if r.extra_restrictions and not options.xml: 33 print("User-provided restrictions in force:") 34 for uri, expr in r.extra_restrictions.items(): 35 print(" {uri}: {expr}".format(uri = uri, expr = expr)) 36 print() 37 elif os.path.exists(args[0]): 38 with open(args[0], 'rb') as stream: 39 sels = selections.Selections(qdom.parse(stream)) 40 else: 41 raise SafeException(_("Neither an app nor a file: '%s'") % args[0]) 42 43 if options.root_uri: 44 print(sels.interface) 45 elif options.xml: 46 select.show_xml(sels) 47 else: 48 select.show_human(sels, config.stores)49 57
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Mar 26 18:14:10 2013 | http://epydoc.sourceforge.net |