<commit_before>#!/usr/bin/env python

import glob
import os
import sys


GYPI_TEMPLATE = """\
{
  'variables': {
    'libchromiumcontent_dir': '%(src)s',
    'libchromiumcontent_shared_libraries': %(shared_libraries)s,
  },
}
"""


def main(target_file, src):
  shared_libraries = glob.glob(os.path.join(src, '*.dylib'))
  shared_libraries = [os.path.abspath(l) for l in shared_libraries]
  content = GYPI_TEMPLATE % {
    'src': os.path.dirname(target_file),
    'shared_libraries': shared_libraries,
  }
  with open(target_file, 'wb+') as f:
    f.write(content)


if __name__ == '__main__':
  sys.exit(main(sys.argv[1], sys.argv[2]))
<commit_msg>Generate filenames for all platforms<commit_after>#!/usr/bin/env python

import glob
import os
import sys


TARGET_PLATFORM = {
  'cygwin': 'win32',
  'darwin': 'darwin',
  'linux2': 'linux',
  'win32': 'win32',
}[sys.platform]

SHARED_LIBRARY_SUFFIX = {
  'darwin': 'dylib',
  'linux': 'so',
  'win32': 'dll',
}[TARGET_PLATFORM]

EXCLUDE_SHARED_LIBRARIES = {
  'darwin': [],
  'linux': [
    'ffmpegsumo.so',
  ],
  'win32': [],
}[TARGET_PLATFORM]

GYPI_TEMPLATE = """\
{
  'variables': {
    'libchromiumcontent_dir': '%(src)s',
    'libchromiumcontent_shared_libraries': %(shared_libraries)s,
  },
}
"""


def main(target_file, src):
  shared_libraries = searh_files(src, SHARED_LIBRARY_SUFFIX,
                                 EXCLUDE_SHARED_LIBRARIES)
  content = GYPI_TEMPLATE % {
    'src': os.path.dirname(target_file),
    'shared_libraries': shared_libraries,
  }
  with open(target_file, 'wb+') as f:
    f.write(content)


def searh_files(src, suffix, exclude):
  files = glob.glob(os.path.join(src, '*.' + suffix))
  files = list(set(files) - set(exclude))
  return [os.path.abspath(f) for f in files]


if __name__ == '__main__':
  sys.exit(main(sys.argv[1], sys.argv[2]))

{'fraction_non_alphanumeric': 0.16993464052287582, 'fraction_numerical': 0.008169934640522876, 'mean_word_length': 4.1456582633053225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1861816', 'n_tokens_mistral': 760, 'n_tokens_neox': 732, 'n_words': 125}