def install(name=None,
            refresh=False,
            sysupgrade=False,
            pkgs=None,
            sources=None,
            **kwargs):
    try:
        pkg_params, pkg_type = __salt__['pkg_resource.parse_targets'](
            name, pkgs, sources, **kwargs
        )
    except MinionError as exc:
        raise CommandExecutionError(exc)

    if pkg_params is None or len(pkg_params) == 0:
        return {}

    version_num = kwargs.get('version')
    if version_num:
        if pkgs is None and sources is None:
            # Allow 'version' to work for single package target
            pkg_params = {name: version_num}
        else:
            log.warning('\'version\' parameter will be ignored for multiple '
                        'package targets')

    if 'root' in kwargs:
        pkg_params['-r'] = kwargs['root']

    if pkg_type == 'file':
        cmd = ['pacman', '-U', '--noprogressbar', '--noconfirm'] + pkg_params
    elif pkg_type == 'repository':
        targets = []
        problems = []
        options = ['--noprogressbar', '--noconfirm', '--needed']
        for param, version_num in six.iteritems(pkg_params):
            if version_num is None:
                targets.append(param)
            else:
                match = re.match('^([<>])?(=)?([^<>=]+)$', version_num)
                if match:
                    gt_lt, eq, verstr = match.groups()
                    prefix = gt_lt or ''
                    prefix += eq or ''
                    # If no prefix characters were supplied, use '='
                    prefix = prefix or '='
                    targets.append('{0}{1}{2}'.format(param, prefix, verstr))
                else:
                    msg = 'Invalid version string \'{0}\' for package ' \
                          '\'{1}\''.format(version_num, name)
                    problems.append(msg)
        if problems:
            for problem in problems:
                log.error(problem)
            return {}

        if salt.utils.is_true(refresh):
            options.append('-y')
        if salt.utils.is_true(sysupgrade):
            options.append('-u')

        cmd = ['pacman', '-S'] + options + targets

    old = list_pkgs()
    out = __salt__['cmd.run_all'](
        cmd,
        output_loglevel='trace',
        python_shell=False
    )

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []

    __context__.pop('pkg.list_pkgs', None)
    new = list_pkgs()
    ret = salt.utils.compare_dicts(old, new)

    if errors:
        raise CommandExecutionError(
            'Problem encountered installing package(s)',
            info={'errors': errors, 'changes': ret}
        )

    return ret
Search the system and build lists of available fonts.
dataset/ETHPy150Open saltstack/salt/salt/modules/pacman.py/install--crossover with--dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/findfonts.py/loadFonts