printing/cups_config_helper.py
def run_cups_config(cups_config, mode):
  """Run cups-config with all --cflags etc modes, parse out the mode we want,
  and return those flags as a list."""

  cups = subprocess.Popen([cups_config, '--cflags', '--ldflags', '--libs'],
                          stdout=subprocess.PIPE, universal_newlines=True)
  flags = cups.communicate()[0].strip()

  flags_subset = []
  for flag in flags.split():
    flag_mode = None
    if flag.startswith('-l'):
      flag_mode = '--libs'
    elif (flag.startswith('-L') or flag.startswith('-Wl,')):
      flag_mode = '--ldflags'
    elif (flag.startswith('-I') or flag.startswith('-D')):
      flag_mode = '--cflags'

    # Be conservative: for flags where we don't know which mode they
    # belong in, always include them.
    if flag_mode is None or flag_mode == mode:
      flags_subset.append(flag)

  # Note: cross build is confused by the option, and may trigger linker
  # warning causing build error.
  if '-lgnutls' in flags_subset:
    flags_subset.remove('-lgnutls')

  return flags_subset
Run cups-config with all --cflags etc modes, parse out the mode we want,
  and return those flags as a list.
Run cups-config with all --cflags etc modes, parse out the mode we want,
and return those flags as a list.
Run cups - config with all -- cflags etc modes parse out the mode we want and return those flags as a list .
def run_cups_config(cups_config, mode):
  cups = subprocess.Popen([cups_config, '--cflags', '--ldflags', '--libs'],
                          stdout=subprocess.PIPE, universal_newlines=True)
  flags = cups.communicate()[0].strip()
  flags_subset = []
  for flag in flags.split():
    flag_mode = None
    if flag.startswith('-l'):
      flag_mode = '--libs'
    elif (flag.startswith('-L') or flag.startswith('-Wl,')):
      flag_mode = '--ldflags'
    elif (flag.startswith('-I') or flag.startswith('-D')):
      flag_mode = '--cflags'
    if flag_mode is None or flag_mode == mode:
      flags_subset.append(flag)
  if '-lgnutls' in flags_subset:
    flags_subset.remove('-lgnutls')
  return flags_subset
def run_cups_config ( cups_config , mode ) : cups = subprocess . Popen ( [ cups_config , '--cflags' , '--ldflags' , '--libs' ] , stdout = subprocess . PIPE , universal_newlines = True ) flags = cups . communicate ( ) [ 0 ] . strip ( ) flags_subset = [ ] for flag in flags . split ( ) : flag_mode = None if flag . startswith ( '-l' ) : flag_mode = '--libs' elif ( flag . startswith ( '-L' ) or flag . startswith ( '-Wl,' ) ) : flag_mode = '--ldflags' elif ( flag . startswith ( '-I' ) or flag . startswith ( '-D' ) ) : flag_mode = '--cflags' if flag_mode is None or flag_mode == mode : flags_subset . append ( flag ) if '-lgnutls' in flags_subset : flags_subset . remove ( '-lgnutls' ) return flags_subset
Run cups-config with all --cflags etc modes, parse out the mode we want,
and return those flags as a list.
Run cups - config with all -- cflags etc modes parse out the mode we want and return those flags as a list .
"""Run cups-config with all --cflags etc modes, parse out the mode we want,
  and return those flags as a list.""" # Be conservative: for flags where we don't know which mode they # belong in, always include them. # Note: cross build is confused by the option, and may trigger linker # warning causing build error.
cups_config
mode