root/branches/Dirk_CPtr/Tools/set_source_default_svnprops.py

Revision 263, 1.0 kB (checked in by allenb, 2 years ago)

Add script to set default svn properties on source files.

Line 
1 #
2 # Run in source directory to change all file eol-style's
3 #
4
5 import os, sys, os.path
6 pj = os.path.join
7
8 def isSourceFile(fname):
9    if fname in ["SConstruct","SConscript","build.info"]:
10       return True
11    ext = os.path.splitext(fname)[1]
12    return ext in [".c",".cpp",".h",".inl",".ins",".fcd",".yy",".ll",".py"]
13
14 def isWindowsFile(fname):
15    ext = os.path.splitext(fname)[1]
16    return ext in [".dsp",".dsw"]
17
18 source_files = []
19 msvs_files = []
20
21 for root, dirs, files in os.walk('.'):
22    source_files.extend([pj(root,f) for f in files if isSourceFile(f)])
23    msvs_files.extend([pj(root,f) for f in files if isWindowsFile(f)])
24
25 print "Source files: "
26
27 for f in source_files:
28    print f
29  
30 print "Windows files: "
31 for f in msvs_files:
32    print f
33
34 print "Setting eol-styles"
35 for f in source_files:
36    cmd = "svn propset svn:eol-style native %s"%f
37    print "cmd: %s ..."%cmd,
38    os.system(cmd)
39    print "[OK]"
40
41 print "Setting keywords=Id"
42 for f in source_files:
43    cmd = "svn propset svn:keywords Id %s"%f
44    print "cmd: %s ..."%cmd,
45    os.system(cmd)
46    print "[OK]"
Note: See TracBrowser for help on using the browser.