(source_files, native_type, emit_js)
return result
Read, prepare and assemble the list of source files.

  Args:
    source_files: List of JavaScript-ish source files. A file named macros.py
        will be treated as a list of macros.
    native_type: String corresponding to a NativeType enum value, allowing us
        to treat different types of sources differently.
    emit_js: True if we should skip the byte conversion and just leave the
        sources as JS strings.

  Returns:
    An instance of Sources.
Read, prepare and assemble the list of source files.
Read prepare and assemble the list of source files .
def PrepareSources(source_files, native_type, emit_js):
  """Read, prepare and assemble the list of source files.

  Args:
    source_files: List of JavaScript-ish source files. A file named macros.py
        will be treated as a list of macros.
    native_type: String corresponding to a NativeType enum value, allowing us
        to treat different types of sources differently.
    emit_js: True if we should skip the byte conversion and just leave the
        sources as JS strings.

  Returns:
    An instance of Sources.
  """
  macro_file = None
  macro_files = filter(IsMacroFile, source_files)
  assert len(macro_files) in [0, 1]
  if macro_files:
    source_files.remove(macro_files[0])
    macro_file = macro_files[0]

  message_template_file = None
  message_template_files = filter(IsMessageTemplateFile, source_files)
  assert len(message_template_files) in [0, 1]
  if message_template_files:
    source_files.remove(message_template_files[0])
    message_template_file = message_template_files[0]

  filters = None
  if native_type in ("EXTRAS", "EXPERIMENTAL_EXTRAS"):
    filters = BuildExtraFilterChain()
  else:
    filters = BuildFilterChain(macro_file, message_template_file)

  # Sort 'debugger' sources first.
  source_files = sorted(source_files,
                        lambda l,r: IsDebuggerFile(r) - IsDebuggerFile(l))

  source_files_and_contents = [(f, ReadFile(f)) for f in source_files]

  # Have a single not-quite-empty source file if there are none present;
  # otherwise you get errors trying to compile an empty C++ array.
  # It cannot be empty (or whitespace, which gets trimmed to empty), as
  # the deserialization code assumes each file is nonempty.
  if not source_files_and_contents:
    source_files_and_contents = [("dummy.js", "(function() {})")]

  result = Sources()

  for (source, contents) in source_files_and_contents:
    try:
      lines = filters(contents)
    except Error as e:
      raise Error("In file %s:\n%s" % (source, str(e)))

    result.modules.append(lines)

    is_debugger = IsDebuggerFile(source)
    result.is_debugger_id.append(is_debugger)

    name = os.path.basename(source)[:-3]
    result.names.append(name)

  return result
def PrepareSources ( source_files , native_type , emit_js ) : macro_file = None macro_files = filter ( IsMacroFile , source_files ) assert len ( macro_files ) in [ 0 , 1 ] if macro_files : source_files . remove ( macro_files [ 0 ] ) macro_file = macro_files [ 0 ] message_template_file = None message_template_files = filter ( IsMessageTemplateFile , source_files ) assert len ( message_template_files ) in [ 0 , 1 ] if message_template_files : source_files . remove ( message_template_files [ 0 ] ) message_template_file = message_template_files [ 0 ] filters = None if native_type in ( "EXTRAS" , "EXPERIMENTAL_EXTRAS" ) : filters = BuildExtraFilterChain ( ) else : filters = BuildFilterChain ( macro_file , message_template_file ) # Sort 'debugger' sources first. source_files = sorted ( source_files , lambda l , r : IsDebuggerFile ( r ) - IsDebuggerFile ( l ) ) source_files_and_contents = [ ( f , ReadFile ( f ) ) for f in source_files ] # Have a single not-quite-empty source file if there are none present; # otherwise you get errors trying to compile an empty C++ array. # It cannot be empty (or whitespace, which gets trimmed to empty), as # the deserialization code assumes each file is nonempty. if not source_files_and_contents : source_files_and_contents = [ ( "dummy.js" , "(function() {})" ) ] result = Sources ( ) for ( source , contents ) in source_files_and_contents : try : lines = filters ( contents ) except Error as e : raise Error ( "In file %s:\n%s" % ( source , str ( e ) ) ) result . modules . append ( lines ) is_debugger = IsDebuggerFile ( source ) result . is_debugger_id . append ( is_debugger ) name = os . path . basename ( source ) [ : - 3 ] result . names . append ( name ) return result