parameters: (pkgname, tool = "pkg-config")
return_statement: return defs
docstring: Returns a dictionary of preprocessor definitions.
docstring_summary: Returns a dictionary of preprocessor definitions.
docstring_tokens: Returns a dictionary of preprocessor definitions .
function: def PkgConfigGetDefSymbols(pkgname, tool = "pkg-config"):
      """Returns a dictionary of preprocessor definitions."""
  
      if (sys.platform == "win32" or CrossCompiling() or not LocateBinary(tool)):
          return []
      if (tool == "pkg-config"):
          handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --cflags " + pkgname)
      else:
          handle = os.popen(LocateBinary(tool) + " --cflags")
      result = handle.read().strip()
      handle.close()
      if len(result) == 0: return {}
      defs = {}
      for l in result.split(" "):
          if (l.startswith("-D")):
              d = l.replace("-D", "").replace("\"", "").strip().split("=")
  
              if d[0] in ('NDEBUG', '_DEBUG'):
                  # Setting one of these flags by accident could cause serious harm.
                  if GetVerbose():
                      print("Ignoring %s flag provided by %s" % (l, tool))
              elif len(d) == 1:
                  defs[d[0]] = ""
              else:
                  defs[d[0]] = d[1]
      return defs
function_tokens: def PkgConfigGetDefSymbols ( pkgname , tool = "pkg-config" ) : if ( sys . platform == "win32" or CrossCompiling ( ) or not LocateBinary ( tool ) ) : return [ ] if ( tool == "pkg-config" ) : handle = os . popen ( LocateBinary ( "pkg-config" ) + " --silence-errors --cflags " + pkgname ) else : handle = os . popen ( LocateBinary ( tool ) + " --cflags" ) result = handle . read ( ) . strip ( ) handle . close ( ) if len ( result ) == 0 : return { } defs = { } for l in result . split ( " " ) : if ( l . startswith ( "-D" ) ) : d = l . replace ( "-D" , "" ) . replace ( "\"" , "" ) . strip ( ) . split ( "=" ) if d [ 0 ] in ( 'NDEBUG' , '_DEBUG' ) : # Setting one of these flags by accident could cause serious harm. if GetVerbose ( ) : print ( "Ignoring %s flag provided by %s" % ( l , tool ) ) elif len ( d ) == 1 : defs [ d [ 0 ] ] = "" else : defs [ d [ 0 ] ] = d [ 1 ] return defs