Exemplo n.º 1
0
def _0install_man(config, command):
	from zeroinstall import apps, alias, helpers

	path = support.find_in_path(command)
	if not path:
		return None

	with open(path, 'rt') as stream:
		app_info = apps.parse_script_header(stream)
		if app_info:
			app = config.app_mgr.lookup_app(app_info.name)
			sels = app.get_selections()
			main = None
		else:
			alias_info = alias.parse_script_header(stream)
			if alias_info is None:
				return None
			sels = helpers.ensure_cached(alias_info.uri, alias_info.command, config = config)
			if not sels:
				# Cancelled by user
				sys.exit(1)
			main = alias_info.main

	helpers.exec_man(config.stores, sels, main, fallback_name = command)
	assert 0
Exemplo n.º 2
0
def _0install_man(config, command):
    from zeroinstall import apps, alias, helpers

    path = support.find_in_path(command)
    if not path:
        return None

    with open(path, 'rt') as stream:
        app_info = apps.parse_script_header(stream)
        if app_info:
            app = config.app_mgr.lookup_app(app_info.name)
            sels = app.get_selections()
            main = None
        else:
            alias_info = alias.parse_script_header(stream)
            if alias_info is None:
                return None
            sels = helpers.ensure_cached(alias_info.uri,
                                         alias_info.command,
                                         config=config)
            if not sels:
                # Cancelled by user
                sys.exit(1)
            main = alias_info.main

    helpers.exec_man(config.stores, sels, main, fallback_name=command)
    assert 0
Exemplo n.º 3
0
def _0install_man(config, command):
    """@type command: str"""
    from zeroinstall import apps, alias, helpers

    path = support.find_in_path(command)
    if not path:
        return None

    try:
        with open(path, 'rt') as stream:
            app_info = apps.parse_script_header(stream)
            if app_info:
                app = config.app_mgr.lookup_app(app_info.name)
                sels = app.get_selections()
                main = None
            else:
                alias_info = alias.parse_script_header(stream)
                if alias_info is None:
                    return None
                sels = helpers.ensure_cached(alias_info.uri,
                                             alias_info.command,
                                             config=config)
                if not sels:
                    # Cancelled by user
                    sys.exit(1)
                main = alias_info.main
    except IOError as ex:
        logger.info("%s: falling back to `man %s`", ex, command)
        os.execlp('man', 'man', command)
        sys.exit(1)

    helpers.exec_man(config.stores, sels, main, fallback_name=command)
    assert 0
Exemplo n.º 4
0
def _0install_man(config, command):
    """@type command: str"""
    from zeroinstall import apps, alias, helpers

    path = support.find_in_path(command)
    if not path:
        return None

    try:
        with open(path, "rt") as stream:
            app_info = apps.parse_script_header(stream)
            if app_info:
                app = config.app_mgr.lookup_app(app_info.name)
                sels = app.get_selections()
                main = None
            else:
                alias_info = alias.parse_script_header(stream)
                if alias_info is None:
                    return None
                sels = helpers.ensure_cached(alias_info.uri, alias_info.command, config=config)
                if not sels:
                    # Cancelled by user
                    sys.exit(1)
                main = alias_info.main
    except IOError as ex:
        logger.info("%s: falling back to `man %s`", ex, command)
        os.execlp("man", "man", command)
        sys.exit(1)

    helpers.exec_man(config.stores, sels, main, fallback_name=command)
    assert 0