def has_flag(compiler, flagname):
    """Return a boolean indicating whether a flag name is supported on
    the specified compiler.
    """
    with TemporaryDirectory() as tmpdir, \
            stdchannel_redirected(sys.stderr, os.devnull), \
            stdchannel_redirected(sys.stdout, os.devnull):
        f = tempfile.mktemp(suffix='.cpp', dir=tmpdir)
        with open(f, 'w') as fh:
            fh.write('int main (int argc, char **argv) { return 0; }')
        try:
            compiler.compile([f], extra_postargs=[flagname], output_dir=tmpdir)
        except setuptools.distutils.errors.CompileError:
            return False
    return True
def has_flag ( compiler , flagname ) : with TemporaryDirectory ( ) as tmpdir , stdchannel_redirected ( sys . stderr , os . devnull ) , stdchannel_redirected ( sys . stdout , os . devnull ) : f = tempfile . mktemp ( suffix = '.cpp' , dir = tmpdir ) with open ( f , 'w' ) as fh : fh . write ( 'int main (int argc, char **argv) { return 0; }' ) try : compiler . compile ( [ f ] , extra_postargs = [ flagname ] , output_dir = tmpdir ) except setuptools . distutils . errors . CompileError : return False return True
Return a boolean indicating whether a flag name is supported on
    the specified compiler.