def get_flags_from_package_conf(conf, atom):
    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 AttributeError:
                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)
Get flags for a given package or DEPEND atom.
dataset/ETHPy150Open saltstack/salt/salt/modules/portage_config.py/get_flags_from_package_conf