def _detect_cc_type(ctx, cc_cmd):
    cc_type = None

    def detect_type(vflag):
        cmd = cc_cmd + [vflag]
        env = os.environ
        env["LC_ALL"] = env["LANGUAGE"] = "C"
        p = Popen(cmd, stdout=PIPE, stderr=STDOUT, env=env)
        out = p.communicate()[0].decode()
        for k, v in CC_SIGNATURE.items():
            m = v.search(out)
            if m:
                return k
        return None

    _OUTPUT.write("Detecting CC type... ")
    if sys.platform == "win32":
        for v in ["", "-v"]:
            cc_type = detect_type(v)
    else:
        try:
            for v in ["-v", "-V", "-###"]:
                cc_type = detect_type(v)
                if cc_type:
                    break
            if cc_type is None:
                cc_type = "cc"
        except OSError:
            e = extract_exception()
            if e.errno == errno.ENOENT:
                raise ValueError("compiler %r not found" % " ".join(cc_cmd))
            else:
                raise ValueError("Unexpected error %r when testing compiler %r" % (e, cc_cmd))
    _OUTPUT.write(cc_type % "%s\n")
    return cc_type
dataset/ETHPy150Open cournape/Bento/bento/private/_yaku/yaku/tools/pyext.py/_detect_cc_type/swapped operands of `%`