parameters: (filename, defines)
return_statement: return (src_root_dir, first_ids_dict)
docstring: Read the starting resource id values from |filename|.  We also
    expand variables of the form <(FOO) based on defines passed in on
    the command line.
  
    Returns a tuple, the absolute path of SRCDIR followed by the
    first_ids dictionary.
docstring_summary: Read the starting resource id values from |filename|.  We also
    expand variables of the form <(FOO) based on defines passed in on
    the command line.
docstring_tokens: Read the starting resource id values from |filename| . We also expand variables of the form < ( FOO ) based on defines passed in on the command line .
function: def _ReadFirstIdsFromFile(filename, defines):
    """Read the starting resource id values from |filename|.  We also
    expand variables of the form <(FOO) based on defines passed in on
    the command line.
  
    Returns a tuple, the absolute path of SRCDIR followed by the
    first_ids dictionary.
    """
    first_ids_dict = eval(util.ReadFile(filename, util.RAW_TEXT))
    src_root_dir = os.path.abspath(os.path.join(os.path.dirname(filename),
                                                first_ids_dict['SRCDIR']))
  
    def ReplaceVariable(matchobj):
      for key, value in defines.iteritems():
        if matchobj.group(1) == key:
          return value
      return ''
  
    renames = []
    for grd_filename in first_ids_dict:
      new_grd_filename = re.sub(r'<\(([A-Za-z_]+)\)', ReplaceVariable,
                                grd_filename)
      if new_grd_filename != grd_filename:
        abs_grd_filename = os.path.abspath(new_grd_filename)
        if abs_grd_filename[:len(src_root_dir)] != src_root_dir:
          new_grd_filename = os.path.basename(abs_grd_filename)
        else:
          new_grd_filename = abs_grd_filename[len(src_root_dir) + 1:]
          new_grd_filename = new_grd_filename.replace('\\', '/')
        renames.append((grd_filename, new_grd_filename))
  
    for grd_filename, new_grd_filename in renames:
      first_ids_dict[new_grd_filename] = first_ids_dict[grd_filename]
      del(first_ids_dict[grd_filename])
  
    return (src_root_dir, first_ids_dict)
function_tokens: def _ReadFirstIdsFromFile ( filename , defines ) : first_ids_dict = eval ( util . ReadFile ( filename , util . RAW_TEXT ) ) src_root_dir = os . path . abspath ( os . path . join ( os . path . dirname ( filename ) , first_ids_dict [ 'SRCDIR' ] ) ) def ReplaceVariable ( matchobj ) : for key , value in defines . iteritems ( ) : if matchobj . group ( 1 ) == key : return value return '' renames = [ ] for grd_filename in first_ids_dict : new_grd_filename = re . sub ( r'<\(([A-Za-z_]+)\)' , ReplaceVariable , grd_filename ) if new_grd_filename != grd_filename : abs_grd_filename = os . path . abspath ( new_grd_filename ) if abs_grd_filename [ : len ( src_root_dir ) ] != src_root_dir : new_grd_filename = os . path . basename ( abs_grd_filename ) else : new_grd_filename = abs_grd_filename [ len ( src_root_dir ) + 1 : ] new_grd_filename = new_grd_filename . replace ( '\\' , '/' ) renames . append ( ( grd_filename , new_grd_filename ) ) for grd_filename , new_grd_filename in renames : first_ids_dict [ new_grd_filename ] = first_ids_dict [ grd_filename ] del ( first_ids_dict [ grd_filename ] ) return ( src_root_dir , first_ids_dict )