def _MapFileToMsBuildSourceType(source, rule_dependencies, extension_to_rule_name):
 (_, ext) = os.path.splitext(source)
 if (ext in extension_to_rule_name):
  group = 'rule'
  element = extension_to_rule_name[ext]
 elif (ext in ['.cc', '.cpp', '.c', '.cxx']):
  group = 'compile'
  element = 'ClCompile'
 elif (ext in ['.h', '.hxx']):
  group = 'include'
  element = 'ClInclude'
 elif (ext == '.rc'):
  group = 'resource'
  element = 'ResourceCompile'
 elif (ext == '.asm'):
  group = 'masm'
  element = 'MASM'
 elif (ext == '.idl'):
  group = 'midl'
  element = 'Midl'
 elif (source in rule_dependencies):
  group = 'rule_dependency'
  element = 'CustomBuild'
 else:
  group = 'none'
  element = 'None'
 return (group, element)

def _MapFileToMsBuildSourceType ( source , rule_dependencies , extension_to_rule_name ) : ( _ , ext ) = os . path . splitext ( source ) if ( ext in extension_to_rule_name ) : group = 'rule' element = extension_to_rule_name [ ext ] elif ( ext in [ '.cc' , '.cpp' , '.c' , '.cxx' ] ) : group = 'compile' element = 'ClCompile' elif ( ext in [ '.h' , '.hxx' ] ) : group = 'include' element = 'ClInclude' elif ( ext == '.rc' ) : group = 'resource' element = 'ResourceCompile' elif ( ext == '.asm' ) : group = 'masm' element = 'MASM' elif ( ext == '.idl' ) : group = 'midl' element = 'Midl' elif ( source in rule_dependencies ) : group = 'rule_dependency' element = 'CustomBuild' else : group = 'none' element = 'None' return ( group , element )
returns the group and element type of the source file .