def _ValidateSourcesForOSX(spec, all_sources):
 if (spec.get('type', None) != 'static_library'):
  return
 basenames = {}
 for source in all_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)
  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) + 'libtool on OS X will generate') + ' warnings for them.')
  raise GypError('Duplicate basenames in sources section, see list above')

def _ValidateSourcesForOSX ( spec , all_sources ) : if ( spec . get ( 'type' , None ) != 'static_library' ) : return basenames = { } for source in all_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 ) 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 ) + 'libtool on OS X will generate' ) + ' warnings for them.' ) raise GypError ( 'Duplicate basenames in sources section, see list above' )
makes sure if duplicate basenames are not specified in the source list .