Rewrote svn properties handling script in python. Added more file types.

ThreadPoolClientBranch
Jeff Ames 2008-01-26 10:34:49 +00:00
parent 429d14f3e5
commit 20215c3d30
62 changed files with 2447 additions and 2341 deletions

0
Prebuild/scripts/Clean.bat Normal file → Executable file
View File

0
Prebuild/scripts/Help.bat Normal file → Executable file
View File

0
Prebuild/scripts/SharpDevelop.bat Normal file → Executable file
View File

0
Prebuild/scripts/SharpDevelop2.bat Normal file → Executable file
View File

0
Prebuild/scripts/VS2002.bat Normal file → Executable file
View File

0
Prebuild/scripts/VS2003.bat Normal file → Executable file
View File

0
Prebuild/scripts/VS2005.bat Normal file → Executable file
View File

0
Prebuild/scripts/autotools.bat Normal file → Executable file
View File

0
Prebuild/scripts/nant.bat Normal file → Executable file
View File

0
bin/libode.dylib Executable file → Normal file
View File

0
bin/libopenjpeg-libsl-2.1.2.0.dylib Executable file → Normal file
View File

0
runprebuild.bat Normal file → Executable file
View File

0
runprebuild2008.bat Normal file → Executable file
View File

View File

@ -1,53 +0,0 @@
#!/bin/sh
set_eol_style()
{
IFS=$'\n'
for file in `find . -iname \*\.$1`; do
prop=`svn propget svn:eol-style $file`
if [ -z "${prop}" -o "${prop}" != "native" ]; then
svn propset svn:eol-style native $file
fi
done
IFS=$' \t\n'
}
remove_executable()
{
IFS=$'\n'
for file in `find . -iname \*\.$1`; do
prop=`svn propget svn:executable $file`
if [ -n "${prop}" ]; then
svn propdel svn:executable $file
fi
done
IFS=$' \t\n'
}
set_executable()
{
IFS=$'\n'
for file in `find . -iname \*\.$1`; do
prop=`svn propget svn:executable $file`
if [ -z "${prop}" ]; then
svn propset svn:executable "*" $file
fi
done
IFS=$' \t\n'
}
EOL_EXTENSIONS="cs ini example txt sql xml sh"
NO_EXE_EXTENSIONS="cs ini example txt sql xml"
EXE_EXTENSIONS="exe sh"
for ext in ${EOL_EXTENSIONS}; do
set_eol_style $ext
done
for ext in ${NO_EXE_EXTENSIONS}; do
remove_executable $ext
done
for ext in ${EXE_EXTENSIONS}; do
set_executable $ext
done

0
share/php/generateUserFunction.php Normal file → Executable file
View File

0
share/ruby/aserv.rb Normal file → Executable file
View File

0
share/ruby/config.rb Normal file → Executable file
View File

0
share/ruby/gridserv.rb Normal file → Executable file
View File

0
share/ruby/userserv.rb Normal file → Executable file
View File

159
update-svn-properties.py Executable file
View File

@ -0,0 +1,159 @@
#!/usr/bin/env python
import os, os.path, popen2, re, string, sys
def textfile(file):
return {
"svn:eol-style" : "native"
}
def script(file):
return {
"svn:eol-style" : "native",
"svn:executable" : "*"
}
def executable(file):
return {
"svn:executable" : "*",
"svn:mime-type" : "application/octet-stream"
}
def binary(file):
return {
"svn:mime-type" : "application/octet-stream"
}
def is_binary(file):
f = open(file)
data = f.read()
f.close()
for c in data:
if c not in string.printable:
return True
return False
def binary_or_text(file):
if is_binary(file):
return binary(file)
else:
return textfile(file)
property_map = {
".bat" : script,
".config" : textfile,
".cs" : textfile,
".csproj" : textfile,
".dat" : binary_or_text,
".dll" : binary,
".dylib" : binary,
".example" : textfile,
".exe" : executable,
".fxcop" : textfile,
".ico" : binary,
".include" : textfile,
".ini" : textfile,
".j2c" : binary,
".jp2" : binary,
".lsl" : textfile,
".mdp" : textfile,
".mds" : textfile,
".nsi" : textfile,
".php" : script,
".pidb" : binary,
".pl" : script,
".png" : binary,
".py" : script,
".rb" : script,
".resx" : textfile,
".settings" : textfile,
".stetic" : textfile,
".sh" : script,
".snk" : binary,
".so" : binary,
".sql" : textfile,
".txt" : textfile,
".userprefs" : textfile,
".usertasks" : textfile,
".xml" : textfile,
".xsd" : textfile
}
def propset(file, property, value):
os.system('svn propset %s "%s" "%s"' % (property, value, file))
def propdel(file, property):
os.system('svn propdel %s "%s"' % (property, file))
def propget(file, property):
output, input, error = popen2.popen3('svn propget %s "%s"' % (property, file))
err = error.read()
if err != "":
output.close()
error.close()
input.close()
return ""
result = output.read()
output.close()
error.close()
input.close()
return result.strip()
def proplist(file):
output, input, error = popen2.popen3('svn proplist "%s"' % file)
err = error.read()
if err != "":
output.close()
error.close()
input.close()
return None
result = output.readlines()
output.close()
error.close()
input.close()
if len(result) > 0 and re.match("^Properties on .*:$", result[0]) is not None:
return [r.strip() for r in result[1:]]
else:
return ""
def update_file(file, properties):
current_props = proplist(file)
if current_props is None:
# svn error occurred -- probably an unversioned file
return
for p in current_props:
if not properties.has_key(p):
propdel(file, p)
for p in properties:
if p not in current_props or propget(file, p) != properties[p]:
propset(file, p, properties[p])
def update(dir):
for f in os.listdir(dir):
fullpath = os.path.join(dir, f)
if os.path.isdir(fullpath):
if not os.path.islink(fullpath):
update(fullpath)
else:
extension = os.path.splitext(fullpath)[1].lower()
if property_map.has_key(extension):
update_file(fullpath, property_map[extension](fullpath))
elif extension != "" and proplist(fullpath) is not None:
print "Warning: No properties defined for %s files (%s)" % (extension, fullpath)
def main(argv = None):
if argv is None:
argv = sys.argv
update(".")
if __name__ == "__main__":
sys.exit(main())