parameters: (spec, version)
docstring: Makes sure if duplicate basenames are not specified in the source list.
  
    Arguments:
      spec: The target dictionary containing the properties of the target.
      version: The VisualStudioVersion object.
docstring_summary: Makes sure if duplicate basenames are not specified in the source list.
docstring_tokens: Makes sure if duplicate basenames are not specified in the source list .
function: def _ValidateSourcesForMSVSProject(spec, version):
    """Makes sure if duplicate basenames are not specified in the source list.
  
    Arguments:
      spec: The target dictionary containing the properties of the target.
      version: The VisualStudioVersion object.
    """
    # This validation should not be applied to MSVC2010 and later.
    assert not version.UsesVcxproj()
  
    # TODO: Check if MSVC allows this for loadable_module targets.
    if spec.get('type', None) not in ('static_library', 'shared_library'):
      return
    sources = spec.get('sources', [])
    basenames = {}
    for source in sources:
      name, ext = os.path.splitext(source)
      is_compiled_file = ext in [
          '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S']
      if not is_compiled_file:
        continue
      basename = os.path.basename(name)  # Don't include extension.
      basenames.setdefault(basename, []).append(source)
  
    error = ''
    for basename, files in basenames.iteritems():
      if len(files) > 1:
        error += '  %s: %s\n' % (basename, ' '.join(files))
  
    if error:
      print('static library %s has several files with the same basename:\n' %
            spec['target_name'] + error + 'MSVC08 cannot handle that.')
      raise GypError('Duplicate basenames in sources section, see list above')
function_tokens: def _ValidateSourcesForMSVSProject ( spec , version ) : # This validation should not be applied to MSVC2010 and later. assert not version . UsesVcxproj ( ) # TODO: Check if MSVC allows this for loadable_module targets. if spec . get ( 'type' , None ) not in ( 'static_library' , 'shared_library' ) : return sources = spec . get ( 'sources' , [ ] ) basenames = { } for source in sources : name , ext = os . path . splitext ( source ) is_compiled_file = ext in [ '.c' , '.cc' , '.cpp' , '.cxx' , '.m' , '.mm' , '.s' , '.S' ] if not is_compiled_file : continue basename = os . path . basename ( name ) # Don't include extension. basenames . setdefault ( basename , [ ] ) . append ( source ) error = '' for basename , files in basenames . iteritems ( ) : if len ( files ) > 1 : error += '  %s: %s\n' % ( basename , ' ' . join ( files ) ) if error : print ( 'static library %s has several files with the same basename:\n' % spec [ 'target_name' ] + error + 'MSVC08 cannot handle that.' ) raise GypError ( 'Duplicate basenames in sources section, see list above' )