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

# Copyright (c) 2013, <NAME>
# All rights reserved.

import argparse
import glob
import os
import platform
import re
import shutil
import subprocess
import sys

parser = argparse.ArgumentParser(description="Run all tests")

parser.add_argument('--include', nargs='*', type=str)

args = parser.parse_args()

class Log:
  def __init__(self):
    pass
  def p(self, message):
    print('##### {}'.format(message))

class Backup:
  def __init__(self, origin_location, save_location, save_dir):
    self.origin_location = origin_location
    self.save_location = save_location
    self.save_dir = save_dir
    log.p(
         'save downloaded file: {} -> {}'.format(
             self.origin_location, self.save_location
         )
    )
    shutil.copyfile(self.origin_location, self.save_location)

  def restore(self):
    log.p(
         'restore downloaded file: {} -> {}'.format(
             self.save_location, self.origin_location
         )
    )
    os.makedirs(self.save_dir)
    shutil.copyfile(self.save_location, self.origin_location)

def rmtree_workaround(directory):
  if not os.path.exists(directory):
    return
  if os.name == 'nt':
    # Fix windows error: `path too long`
    os.system('rmdir {} /s /q'.format(directory))
  else:
    shutil.rmtree(directory)

log = Log()

testing_dirs = []
if not args.include:
  for project in glob.iglob('*/CMakeLists.txt'):
    project = os.path.normpath(project)
    if os.path.exists(os.path.join(os.path.dirname(project), 'Xcode')):
      if not platform.system() == 'Darwin':
        continue
    testing_dirs.append(project)
else:
  for incl in args.include:
    project = os.path.join(os.path.normpath(incl), 'CMakeLists.txt')
    if not os.path.exists(project):
      sys.exit('Project not found: `{}`'.format(project))
    testing_dirs.append(project)

if not testing_dirs:
  log.p('No projects to run')
  sys.exit()

for x in testing_dirs:
  log.p('Add to testing: {}'.format(x))

top_dir = os.getcwd()
for project in testing_dirs:
  os.chdir(os.path.dirname(project))
  toolchain_path = os.path.abspath('toolchain.cmake')

  if os.path.exists(toolchain_path):
    toolchain_option = '-DCMAKE_TOOLCHAIN_FILE={}'.format(toolchain_path)
  else:
    toolchain_option = ''
<commit_msg>Do not test iOS on Linux<commit_after>#!/usr/bin/env python3

# Copyright (c) 2013, <NAME>
# All rights reserved.

import argparse
import glob
import os
import platform
import re
import shutil
import subprocess
import sys

parser = argparse.ArgumentParser(description="Run all tests")

parser.add_argument('--include', nargs='*', type=str)

args = parser.parse_args()

class Log:
  def __init__(self):
    pass
  def p(self, message):
    print('##### {}'.format(message))

class Backup:
  def __init__(self, origin_location, save_location, save_dir):
    self.origin_location = origin_location
    self.save_location = save_location
    self.save_dir = save_dir
    log.p(
         'save downloaded file: {} -> {}'.format(
             self.origin_location, self.save_location
         )
    )
    shutil.copyfile(self.origin_location, self.save_location)

  def restore(self):
    log.p(
         'restore downloaded file: {} -> {}'.format(
             self.save_location, self.origin_location
         )
    )
    os.makedirs(self.save_dir)
    shutil.copyfile(self.save_location, self.origin_location)

def rmtree_workaround(directory):
  if not os.path.exists(directory):
    return
  if os.name == 'nt':
    # Fix windows error: `path too long`
    os.system('rmdir {} /s /q'.format(directory))
  else:
    shutil.rmtree(directory)

log = Log()

testing_dirs = []
if not args.include:
  for project in glob.iglob('*/CMakeLists.txt'):
    project = os.path.normpath(project)
    if os.path.exists(os.path.join(os.path.dirname(project), 'Xcode')):
      if not platform.system() == 'Darwin':
        continue
    testing_dirs.append(project)
else:
  for incl in args.include:
    project = os.path.join(os.path.normpath(incl), 'CMakeLists.txt')
    if not os.path.exists(project):
      sys.exit('Project not found: `{}`'.format(project))
    if os.path.exists(os.path.join(os.path.dirname(project), 'Xcode')):
      if not platform.system() == 'Darwin':
        continue
    testing_dirs.append(project)

if not testing_dirs:
  log.p('No projects to run')
  sys.exit()

for x in testing_dirs:
  log.p('Add to testing: {}'.format(x))

top_dir = os.getcwd()
for project in testing_dirs:
  os.chdir(os.path.dirname(project))
  toolchain_path = os.path.abspath('toolchain.cmake')

  if os.path.exists(toolchain_path):
    toolchain_option = '-DCMAKE_TOOLCHAIN_FILE={}'.format(toolchain_path)
  else:
    toolchain_option = ''

{'fraction_non_alphanumeric': 0.13709677419354838, 'fraction_numerical': 0.0021222410865874364, 'mean_word_length': 3.540462427745665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1726752', 'n_tokens_mistral': 1621, 'n_tokens_neox': 1589, 'n_words': 345}