parameters: (pkg)
return_statement: return retval
docstring: Run pkg-config on the specified package
    Returns ("-l flags", "-I flags", "-L flags", "version")
    otherwise (None, None, None, None)
docstring_summary: Run pkg-config on the specified package
    Returns ("-l flags", "-I flags", "-L flags", "version")
    otherwise (None, None, None, None)
docstring_tokens: Run pkg - config on the specified package Returns ( - l flags - I flags - L flags version ) otherwise ( None None None None )
function: def pkg_config(pkg):
    """Run pkg-config on the specified package
    Returns ("-l flags", "-I flags", "-L flags", "version")
    otherwise (None, None, None, None)"""
    pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
    retval = ()
    for flag in ['--libs-only-l', '--cflags-only-I',
                 '--libs-only-L', '--modversion']:
      try:
        proc = subprocess.Popen(
            shlex.split(pkg_config) + ['--silence-errors', flag, pkg],
            stdout=subprocess.PIPE)
        val = proc.communicate()[0].strip()
      except OSError as e:
        if e.errno != errno.ENOENT: raise e  # Unexpected error.
        return (None, None, None, None)  # No pkg-config/pkgconf installed.
      retval += (val,)
    return retval
function_tokens: def pkg_config ( pkg ) : pkg_config = os . environ . get ( 'PKG_CONFIG' , 'pkg-config' ) retval = ( ) for flag in [ '--libs-only-l' , '--cflags-only-I' , '--libs-only-L' , '--modversion' ] : try : proc = subprocess . Popen ( shlex . split ( pkg_config ) + [ '--silence-errors' , flag , pkg ] , stdout = subprocess . PIPE ) val = proc . communicate ( ) [ 0 ] . strip ( ) except OSError as e : if e . errno != errno . ENOENT : raise e # Unexpected error. return ( None , None , None , None ) # No pkg-config/pkgconf installed. retval += ( val , ) return retval