<commit_before><commit_msg>Add script to set default svn properties on source files.<commit_after>#
# Run in source directory to change all file eol-style's
#

import os, sys, os.path
pj = os.path.join

def isSourceFile(fname):
   if fname in ["SConstruct","SConscript","build.info"]:
      return True
   ext = os.path.splitext(fname)[1]
   return ext in [".c",".cpp",".h",".inl",".ins",".fcd",".yy",".ll",".py"]

def isWindowsFile(fname):
   ext = os.path.splitext(fname)[1]
   return ext in [".dsp",".dsw"]

source_files = []
msvs_files = []

for root, dirs, files in os.walk('.'):
   source_files.extend([pj(root,f) for f in files if isSourceFile(f)])
   msvs_files.extend([pj(root,f) for f in files if isWindowsFile(f)])

print "Source files: "

for f in source_files:
   print f
 
print "Windows files: "
for f in msvs_files:
   print f

print "Setting eol-styles"
for f in source_files:
   cmd = "svn propset svn:eol-style native %s"%f
   print "cmd: %s ..."%cmd,
   os.system(cmd)
   print "[OK]"

print "Setting keywords=Id"
for f in source_files:
   cmd = "svn propset svn:keywords Id %s"%f
   print "cmd: %s ..."%cmd,
   os.system(cmd)
   print "[OK]"
{'fraction_non_alphanumeric': 0.16523235800344235, 'fraction_numerical': 0.0017211703958691911, 'mean_word_length': 3.786008230452675, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4134646', 'n_tokens_mistral': 451, 'n_tokens_neox': 443, 'n_words': 127}