def GetBuilder(context):
  """Get instance of builder class based on flags."""
  try:
    if "Target:Darwin" in context:
      builder_class = builders.DarwinClientBuilder
    elif "Target:Windows" in context:
      builder_class = builders.WindowsClientBuilder
    elif "Target:LinuxDeb" in context:
      builder_class = builders.LinuxClientBuilder
    elif "Target:LinuxRpm" in context:
      builder_class = builders.CentosClientBuilder
    else:
      parser.error("Bad build context: %s" % context)

  except AttributeError:
    raise RuntimeError("Unable to build for platform %s when running "
                       "on current platform." % args.platform)

  return builder_class(context=context)
dataset/ETHPy150Open google/grr/grr/client/client_build.py/GetBuilder/original