parameters: (dump_syms, binary, out_dir)
return_statement: return True
docstring: Dump symbols of a single binary file and move the result.
  
    Symbols will be extracted to a temporary file and moved into place afterwards. Required
    directories will be created if necessary.
docstring_summary: Dump symbols of a single binary file and move the result.
docstring_tokens: Dump symbols of a single binary file and move the result .
function: def process_binary(dump_syms, binary, out_dir):
    """Dump symbols of a single binary file and move the result.
  
    Symbols will be extracted to a temporary file and moved into place afterwards. Required
    directories will be created if necessary.
    """
    logging.info('Processing binary file: %s' % binary.path)
    ensure_dir_exists(out_dir)
    # tmp_fd will be closed when the file object created by os.fdopen() below gets
    # destroyed.
    tmp_fd, tmp_file = tempfile.mkstemp(dir=out_dir, suffix='.sym')
    try:
      # Run dump_syms on the binary.
      args = [dump_syms, binary.path]
      if binary.debug_path:
        args.append(binary.debug_path)
      proc = subprocess.Popen(args, stdout=os.fdopen(tmp_fd, 'wb'), stderr=subprocess.PIPE)
      _, stderr = proc.communicate()
      if proc.returncode != 0:
        sys.stderr.write('Failed to dump symbols from %s, return code %s\n' %
            (binary.path, proc.returncode))
        sys.stderr.write(stderr)
        os.remove(tmp_file)
        return False
      # Parse the temporary file to determine the full target path.
      with open(tmp_file, 'r') as f:
        header = f.readline().strip()
        # Format of header is: MODULE os arch binary_id binary
        _, _, _, binary_id, binary = header.split(' ')
        out_path = os.path.join(out_dir, binary, binary_id)
        ensure_dir_exists(out_path)
      # Move the temporary file to its final destination.
      shutil.move(tmp_file, os.path.join(out_path, '%s.sym' % binary))
    except Exception as e:
      # Only need to clean up in case of errors.
      try:
        os.remove(tmp_file)
      except EnvironmentError:
        pass
      raise e
    return True
function_tokens: def process_binary ( dump_syms , binary , out_dir ) : logging . info ( 'Processing binary file: %s' % binary . path ) ensure_dir_exists ( out_dir ) # tmp_fd will be closed when the file object created by os.fdopen() below gets # destroyed. tmp_fd , tmp_file = tempfile . mkstemp ( dir = out_dir , suffix = '.sym' ) try : # Run dump_syms on the binary. args = [ dump_syms , binary . path ] if binary . debug_path : args . append ( binary . debug_path ) proc = subprocess . Popen ( args , stdout = os . fdopen ( tmp_fd , 'wb' ) , stderr = subprocess . PIPE ) _ , stderr = proc . communicate ( ) if proc . returncode != 0 : sys . stderr . write ( 'Failed to dump symbols from %s, return code %s\n' % ( binary . path , proc . returncode ) ) sys . stderr . write ( stderr ) os . remove ( tmp_file ) return False # Parse the temporary file to determine the full target path. with open ( tmp_file , 'r' ) as f : header = f . readline ( ) . strip ( ) # Format of header is: MODULE os arch binary_id binary _ , _ , _ , binary_id , binary = header . split ( ' ' ) out_path = os . path . join ( out_dir , binary , binary_id ) ensure_dir_exists ( out_path ) # Move the temporary file to its final destination. shutil . move ( tmp_file , os . path . join ( out_path , '%s.sym' % binary ) ) except Exception as e : # Only need to clean up in case of errors. try : os . remove ( tmp_file ) except EnvironmentError : pass raise e return True