parameters: ()
docstring: Check if the current Python installation (specifically, pyconfig.h)
      appears amenable to building extensions with GCC.  Returns a tuple
      (status, details), where 'status' is one of the following constants:
        CONFIG_H_OK
          all is well, go ahead and compile
        CONFIG_H_NOTOK
          doesn't look good
        CONFIG_H_UNCERTAIN
          not sure -- unable to read pyconfig.h
      'details' is a human-readable string explaining the situation.
  
      Note there are two ways to conclude "OK": either 'sys.version' contains
      the string "GCC" (implying that this Python was built with GCC), or the
      installed "pyconfig.h" contains the string "__GNUC__".
docstring_summary: Check if the current Python installation (specifically, pyconfig.h)
      appears amenable to building extensions with GCC.  Returns a tuple
      (status, details), where 'status' is one of the following constants:
        CONFIG_H_OK
          all is well, go ahead and compile
        CONFIG_H_NOTOK
          doesn't look good
        CONFIG_H_UNCERTAIN
          not sure -- unable to read pyconfig.h
      'details' is a human-readable string explaining the situation.
docstring_tokens: Check if the current Python installation ( specifically pyconfig . h ) appears amenable to building extensions with GCC . Returns a tuple ( status details ) where status is one of the following constants : CONFIG_H_OK all is well go ahead and compile CONFIG_H_NOTOK doesn t look good CONFIG_H_UNCERTAIN not sure -- unable to read pyconfig . h details is a human - readable string explaining the situation .
function: def check_config_h():
  
      """Check if the current Python installation (specifically, pyconfig.h)
      appears amenable to building extensions with GCC.  Returns a tuple
      (status, details), where 'status' is one of the following constants:
        CONFIG_H_OK
          all is well, go ahead and compile
        CONFIG_H_NOTOK
          doesn't look good
        CONFIG_H_UNCERTAIN
          not sure -- unable to read pyconfig.h
      'details' is a human-readable string explaining the situation.
  
      Note there are two ways to conclude "OK": either 'sys.version' contains
      the string "GCC" (implying that this Python was built with GCC), or the
      installed "pyconfig.h" contains the string "__GNUC__".
      """
  
      # XXX since this function also checks sys.version, it's not strictly a
      # "pyconfig.h" check -- should probably be renamed...
  
      from distutils import sysconfig
      import string
      # if sys.version contains GCC then python was compiled with
      # GCC, and the pyconfig.h file should be OK
      if string.find(sys.version,"GCC") >= 0:
          return (CONFIG_H_OK, "sys.version mentions 'GCC'")
  
      fn = sysconfig.get_config_h_filename()
      try:
          # It would probably better to read single lines to search.
          # But we do this only once, and it is fast enough
          f = open(fn)
          try:
              s = f.read()
          finally:
              f.close()
  
      except IOError, exc:
          # if we can't read this file, we cannot say it is wrong
          # the compiler will complain later about this file as missing
          return (CONFIG_H_UNCERTAIN,
                  "couldn't read '%s': %s" % (fn, exc.strerror))
  
      else:
          # "pyconfig.h" contains an "#ifdef __GNUC__" or something similar
          if string.find(s,"__GNUC__") >= 0:
              return (CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn)
          else:
              return (CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn)
function_tokens: def check_config_h ( ) : # XXX since this function also checks sys.version, it's not strictly a # "pyconfig.h" check -- should probably be renamed... from distutils import sysconfig import string # if sys.version contains GCC then python was compiled with # GCC, and the pyconfig.h file should be OK if string . find ( sys . version , "GCC" ) >= 0 : return ( CONFIG_H_OK , "sys.version mentions 'GCC'" ) fn = sysconfig . get_config_h_filename ( ) try : # It would probably better to read single lines to search. # But we do this only once, and it is fast enough f = open ( fn ) try : s = f . read ( ) finally : f . close ( ) except IOError , exc : # if we can't read this file, we cannot say it is wrong # the compiler will complain later about this file as missing return ( CONFIG_H_UNCERTAIN , "couldn't read '%s': %s" % ( fn , exc . strerror ) ) else : # "pyconfig.h" contains an "#ifdef __GNUC__" or something similar if string . find ( s , "__GNUC__" ) >= 0 : return ( CONFIG_H_OK , "'%s' mentions '__GNUC__'" % fn ) else : return ( CONFIG_H_NOTOK , "'%s' does not mention '__GNUC__'" % fn )