def ValidateSourcesInTarget(target, target_dict, build_file,
                            duplicate_basename_check):
  if not duplicate_basename_check:
    return
  if target_dict.get('type', None) != 'static_library':
    return
  sources = target_dict.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' %
          target + error + 'libtool on Mac cannot handle that. Use '
          '--no-duplicate-basename-check to disable this validation.')
    raise GypError('Duplicate basenames in sources section, see list above')
dataset/ETHPy150Open adblockplus/gyp/pylib/gyp/input.py/ValidateSourcesInTarget/original