def handle(config, options, args): """@type config: L{zeroinstall.injector.config.Config} @type args: [str]""" if len(args) != 1: raise UsageError() app = config.app_mgr.lookup_app(args[0], missing_ok = True) if app is not None: sels = app.get_selections() r = app.get_requirements() do_select = r.parse_update_options(options) or options.refresh iface_uri = sels.interface else: iface_uri = model.canonical_iface_uri(args[0]) r = None do_select = True if do_select or options.gui: sels = select.get_selections(config, options, iface_uri, select_only = False, download_only = True, test_callback = None, requirements = r) if not sels: sys.exit(1) # Aborted by user else: dl = app.download_selections(sels) if dl: tasks.wait_for_blocker(dl) tasks.check(dl) if options.xml: select.show_xml(sels) if options.show: select.show_human(sels, config.stores) if app is not None and do_select: print(_("(use '0install update' to save the new parameters)"))
def handle(config, options, args): if len(args) != 1: raise UsageError() app = config.app_mgr.lookup_app(args[0], missing_ok = True) if app is not None: sels = app.get_selections() r = app.get_requirements() if r.extra_restrictions and not options.xml: print("User-provided restrictions in force:") for uri, expr in r.extra_restrictions.items(): print(" {uri}: {expr}".format(uri = uri, expr = expr)) print() elif os.path.exists(args[0]): with open(args[0], 'rb') as stream: sels = selections.Selections(qdom.parse(stream)) else: raise SafeException(_("Neither an app nor a file: '%s'") % args[0]) if options.root_uri: print(sels.interface) elif options.xml: select.show_xml(sels) else: select.show_human(sels, config.stores)
def handle(config, options, args): if len(args) != 1: raise UsageError() app = config.app_mgr.lookup_app(args[0], missing_ok=True) if app is not None: sels = app.get_selections() r = app.get_requirements() if r.extra_restrictions and not options.xml: print("User-provided restrictions in force:") for uri, expr in r.extra_restrictions.items(): print(" {uri}: {expr}".format(uri=uri, expr=expr)) print() elif os.path.exists(args[0]): with open(args[0], 'rb') as stream: sels = selections.Selections(qdom.parse(stream)) else: raise SafeException(_("Neither an app nor a file: '%s'") % args[0]) if options.root_uri: print(sels.interface) elif options.xml: select.show_xml(sels) else: select.show_human(sels, config.stores)
def handle(config, options, args): if len(args) != 1: raise UsageError() iface_uri = model.canonical_iface_uri(args[0]) sels = select.get_selections(config, options, iface_uri, select_only = False, download_only = True, test_callback = None) if not sels: sys.exit(1) # Aborted by user if options.xml: select.show_xml(sels) if options.show: select.show_human(sels, config.stores)
def handle(config, options, args): if len(args) != 1: raise UsageError() iface_uri = model.canonical_iface_uri(args[0]) sels = select.get_selections(config, options, iface_uri, select_only=False, download_only=True, test_callback=None) if not sels: sys.exit(1) # Aborted by user if options.xml: select.show_xml(sels) if options.show: select.show_human(sels, config.stores)