def get_flags_from_package_conf(conf, atom):
    '''
    Get flags for a given package or DEPEND atom.
    Warning: This only works if the configuration files tree is in the correct
    format (the one enforced by enforce_nice_config)

    CLI Example:

    .. code-block:: bash

        salt '*' portage_config.get_flags_from_package_conf license salt
    '''
    if conf in SUPPORTED_CONFS:
        package_file = _get_config_file(conf, atom)
        if '/' not in atom:
            atom = _p_to_cp(atom)

        has_wildcard = '*' in atom
        if has_wildcard:
            match_list = set(atom)
        else:
            try:
                match_list = set(_porttree().dbapi.xmatch("match-all", atom))
            except __HOLE__:
                return []

        flags = []
        try:
            file_handler = salt.utils.fopen(package_file)
        except IOError:
            return []
        else:
            for line in file_handler:
                line = line.strip()
                line_package = line.split()[0]

                found_match = False
                if has_wildcard:
                    found_match = line_package == atom
                else:
                    line_list = _porttree().dbapi.xmatch("match-all", line_package)
                    found_match = match_list.issubset(line_list)

                if found_match:
                    f_tmp = [flag for flag in line.strip().split(' ') if flag][1:]
                    if f_tmp:
                        flags.extend(f_tmp)
                    else:
                        flags.append('~ARCH')
            return _merge_flags(flags)
dataset/ETHPy150Open saltstack/salt/salt/modules/portage_config.py/get_flags_from_package_conf