summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-06-09 13:38:26 -0230
committerDwayne Boone <dwayne@zeroc.com>2008-06-09 13:38:26 -0230
commit177d6497072acf113c1314e685f93d187b29c87d (patch)
tree850c01eb3f61e04d658d9990bbe66062336acbb8
parentMinor fix for chatdemo build system & makedist.py cleanup (diff)
downloadice-177d6497072acf113c1314e685f93d187b29c87d.tar.bz2
ice-177d6497072acf113c1314e685f93d187b29c87d.tar.xz
ice-177d6497072acf113c1314e685f93d187b29c87d.zip
Modified fixVersion/fixCopyright due to branch reorganization.
-rwxr-xr-xFixUtil.py391
-rwxr-xr-xfixCopyright.py306
-rwxr-xr-xfixVersion.py526
3 files changed, 565 insertions, 658 deletions
diff --git a/FixUtil.py b/FixUtil.py
new file mode 100755
index 00000000000..2301fabbe2e
--- /dev/null
+++ b/FixUtil.py
@@ -0,0 +1,391 @@
+#!/usr/bin/env python
+
+import os, sys, shutil, fnmatch, re, glob, getopt
+from stat import *
+
+# **********************************************************************
+#
+# Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+def copyright(commentMark, patchIceE):
+ result = [ ]
+ result.append(commentMark + " **********************************************************************\n")
+ result.append(commentMark + "\n")
+ result.append(commentMark + " Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.\n")
+ result.append(commentMark + "\n")
+ if patchIceE == True:
+ result.append(commentMark + " This copy of Ice-E is licensed to you under the terms described in the\n")
+ result.append(commentMark + " ICEE_LICENSE file included in this distribution.\n")
+ else:
+ result.append(commentMark + " This copy of Ice is licensed to you under the terms described in the\n")
+ result.append(commentMark + " ICE_LICENSE file included in this distribution.\n")
+ result.append(commentMark + "\n")
+ result.append(commentMark + " **********************************************************************\n")
+ return result
+
+#
+# Replace one copyright
+#
+def replaceCopyright(file, commentMark, commentBegin, commentEnd, newCopyrightLines):
+ oldFile = open(file, "r")
+ oldLines = oldFile.readlines()
+
+ done = 0
+ commentFound = 0
+ copyrightFound = 0
+
+ beforeCopyrightLines = []
+ oldCopyrightLines = []
+ newLines = []
+
+ justDone = 0
+
+ if commentBegin == "":
+ for x in oldLines:
+ if not commentFound and (not x.startswith(commentMark) or x.startswith("#!/usr/bin/env")):
+ beforeCopyrightLines.append(x)
+ elif not done and x.startswith(commentMark):
+ commentFound = 1
+ if not copyrightFound and x.lower().find("copyright") != -1:
+ copyrightFound = 1
+ # skip this comment line
+ oldCopyrightLines.append(x)
+ else:
+ if not done:
+ done = 1
+ justDone = 1
+
+ # Eliminate double blank lines after copyright (bug introduced by previous fixCopyright script)
+ if justDone == 1:
+ newLines.append(x)
+ if x != "\n":
+ justDone = 0
+ else:
+ justDone = 2
+ elif justDone == 2:
+ if x != "\n":
+ newLines.append(x)
+ justDone = 0
+ else:
+ newLines.append(x)
+ else:
+ for x in oldLines:
+ if not done:
+ if x.startswith(commentBegin):
+ commentFound = 1
+ if commentFound:
+ if not copyrightFound and x.find("Copyright") != -1:
+ copyrightFound = 1
+
+ # skip this comment line
+ if x.find(commentEnd) != -1:
+ done = 1
+ justDone = 1
+ else:
+ beforeCopyrightLines.append(x)
+ else:
+ # Eliminate double blank lines after copyright (bug introduced by previous fixCopyright script)
+ if justDone == 1:
+ newLines.append(x)
+ if x != "\n":
+ justDone = 0
+ else:
+ justDone = 2
+ elif justDone == 2:
+ if x != "\n":
+ newLines.append(x)
+ justDone = 0
+ else:
+ newLines.append(x)
+
+
+ oldFile.close()
+
+ if copyrightFound and newCopyrightLines != oldCopyrightLines:
+
+ mode = os.stat(file)[ST_MODE]
+
+ #origFile = file + ".orig"
+ #shutil.copy2(file, origFile)
+
+ newFile = open(file, "w")
+ newFile.writelines(beforeCopyrightLines)
+ newFile.writelines(newCopyrightLines)
+
+ #
+ # Hack to keep the .err files
+ #
+ if fnmatch.fnmatch(file, "*test/Slice/errorDetection/*.ice") > 0:
+ newFile.write("\n")
+
+ newFile.writelines(newLines)
+ newFile.close()
+
+ os.chmod(file, S_IMODE(mode))
+ print "------ Replaced copyright in " + file + " -------"
+
+ #
+ # Make sure Windows Makefiles are kept in DOS format.
+ #
+ if fnmatch.fnmatch(file, "*.mak*") or fnmatch.fnmatch(file, "*Make.rules.bcc") or fnmatch.fnmatch(file, "*Make.rules.msvc"):
+ os.popen("unix2dos " + file);
+
+ return copyrightFound
+
+#
+# Replace alls copyrights
+#
+def replaceAllCopyrights(path, patchIceE, recursive):
+
+ cppCopyright = copyright("//", patchIceE)
+ mcCopyright = copyright("; //", patchIceE)
+ makefileCopyright = copyright("#", patchIceE)
+ vbCopyright = copyright("'", patchIceE)
+ pythonCopyright = makefileCopyright
+ rubyCopyright = makefileCopyright
+ xmlCopyright = []
+ xmlCopyright.append("<!--\n");
+ xmlCopyright.extend(copyright("", patchIceE))
+ xmlCopyright.append("-->\n");
+
+ files = os.listdir(path)
+ for x in files:
+ fullpath = os.path.join(path, x);
+ if os.path.isdir(fullpath) and not os.path.islink(fullpath):
+ if recursive:
+ replaceAllCopyrights(fullpath, patchIceE, True)
+ else:
+
+ commentMark = ""
+ commentBegin = ""
+ commentEnd = ""
+ copyrightLines = []
+ skip = 0
+
+ if x == "config" or x == ".depend" or x == ".dummy" or fnmatch.fnmatch(x, "*.dsp") or fnmatch.fnmatch(x, "*.sln") or fnmatch.fnmatch(x, "*.vdproj") or fnmatch.fnmatch(x, "*.err") or fnmatch.fnmatch(x, "*.class") or fnmatch.fnmatch(x, "*.ico") or fnmatch.fnmatch(x, "*.gif") or fnmatch.fnmatch(x, "*.jpg") or fnmatch.fnmatch(x, "*.orig"):
+ print "Skipping file " + fullpath + ": no copyright needed"
+ skip = 1
+ elif fnmatch.fnmatch(x, "Make*") or fnmatch.fnmatch(x, "*.properties"):
+ commentMark = "#"
+ copyrightLines = makefileCopyright
+ elif fnmatch.fnmatch(x, "*.h") or fnmatch.fnmatch(x, "*.cpp") or fnmatch.fnmatch(x, "*.cs") or fnmatch.fnmatch(x, "*.java") or fnmatch.fnmatch(x, "*.l") or fnmatch.fnmatch(x, "*.y"):
+ commentMark = "//"
+ copyrightLines = cppCopyright
+ elif fnmatch.fnmatch(x, "*.ice") and not fnmatch.fnmatch(x, "IllegalIdentifier.ice"):
+ commentMark = "//"
+ copyrightLines = cppCopyright
+ elif fnmatch.fnmatch(x, "*.py"):
+ commentMark = "#"
+ copyrightLines = pythonCopyright
+ elif fnmatch.fnmatch(x, "*.def"):
+ commentMark = "#"
+ copyrightLines = pythonCopyright
+ elif fnmatch.fnmatch(x, "*.cnf"):
+ commentMark = "#"
+ copyrightLines = pythonCopyright
+ elif fnmatch.fnmatch(x, "*.rb"):
+ commentMark = "#"
+ copyrightLines = rubyCopyright
+ elif fnmatch.fnmatch(x, "*.mc"):
+ commentMark = "; //"
+ copyrightLines = mcCopyright
+ elif fnmatch.fnmatch(x, "*.vb"):
+ commentMark = "'"
+ copyrightLines = vbCopyright
+ elif fnmatch.fnmatch(x, "*.xml"):
+ commentBegin = "<!--"
+ commentEnd = "-->"
+ copyrightLines = xmlCopyright
+ else:
+ print "***** Skipping file " + fullpath + ": unknown type"
+ skip = 1
+
+ if not skip:
+ if replaceCopyright(fullpath, commentMark, commentBegin, commentEnd, copyrightLines) == 0:
+ print "***** WARNING: Did not find copyright in " + fullpath
+
+#
+# Version patterns
+#
+vpatCheck = "[0-9]+\.[0-9]+(\.[0-9]+|b[0-9]*)$"
+vpatParse = "([0-9]+)\.([0-9]+)(\.[0-9]+|b[0-9]*)"
+vpatMatch = "([0-9]+\.[0-9]+(\.[0-9]+|b[0-9]*))"
+
+def commaVersion(version):
+ major = majorVersion(version)
+ minor = minorVersion(version)
+ patch = patchVersion(version)
+ return ("%s,%s,%s" % (major, minor, patch))
+
+def intVersion(version):
+ r = re.search(vpatParse, version)
+ major = int(r.group(1))
+ minor = int(r.group(2))
+ gr3 = r.group(3)
+ patch = -1
+ if gr3.startswith("."):
+ patch = int(gr3[1:])
+ else:
+ if len(gr3) > 1:
+ patch = 50 + int(gr3[1:])
+ else:
+ patch = 51
+ return ("%2d%02d%02d" % (major, minor, patch)).strip()
+
+def betaVersion(version):
+ r = re.search(vpatParse, version)
+ if r.group(3).startswith("b"):
+ return "b"
+ else:
+ return ""
+
+def soVersion(version):
+ r = re.search(vpatParse, version)
+ major = int(r.group(1))
+ minor = int(r.group(2))
+ v = ("%d%d" % (major, minor)).strip()
+ if r.group(3).startswith("b"):
+ return v + "b"
+ else:
+ return v
+
+def majorVersion(version):
+ r = re.search(vpatParse, version)
+ major = int(r.group(1))
+ return ("%d" % (major)).strip()
+
+def minorVersion(version):
+ r = re.search(vpatParse, version)
+ minor = int(r.group(2))
+ return ("%d" % (minor)).strip()
+
+def shortVersion(version):
+ r = re.search(vpatParse, version)
+ major = int(r.group(1))
+ minor = int(r.group(2))
+ return ("%d.%d" % (major, minor)).strip()
+
+def patchVersion(version):
+ r = re.search(vpatParse, version)
+
+ gr3 = r.group(3)
+ patch = -1
+ if gr3.startswith("."):
+ patch = int(gr3[1:])
+ else:
+ if len(gr3) > 1:
+ patch = 50 + int(gr3[1:])
+ else:
+ patch = 51
+
+ return ("%d" % (patch)).strip()
+
+#
+# Find files matching a pattern.
+#
+def find(path, patt):
+ result = [ ]
+ files = os.listdir(path)
+ for x in files:
+ fullpath = os.path.join(path, x);
+ if os.path.isdir(fullpath) and not os.path.islink(fullpath):
+ result.extend(find(fullpath, patt))
+ elif fnmatch.fnmatch(x, patt):
+ result.append(fullpath)
+ return result
+
+
+#
+# Replace a string matched by the first group of regular expression.
+#
+# For example: the regular expression "ICE_STRING_VERSION \"([0-9]*\.[0-9]*\.[0-9]*)\""
+# will match the string version in "ICE_STRING_VERSION "2.1.0"" and will replace it with
+# the given version.
+#
+def fileMatchAndReplace(filename, matchAndReplaceExps, warn=True):
+
+ mode = os.stat(filename).st_mode
+ oldConfigFile = open(filename, "r")
+ newConfigFile = open(filename + ".new", "w")
+
+ #
+ # Compile the regular expressions
+ #
+ regexps = [ ]
+ for (regexp, replace) in matchAndReplaceExps:
+ regexps.append((re.compile(regexp), replace))
+
+ #
+ # Search for the line with the given regular expressions and
+ # replace the matching string
+ #
+ updated = False
+ for line in oldConfigFile.readlines():
+ for (regexp, replace) in regexps:
+ match = regexp.search(line)
+ if match != None:
+ oldLine = line
+ line = oldLine.replace(match.group(1), replace)
+# print oldLine + line
+ updated = True
+ break
+ newConfigFile.write(line)
+
+ newConfigFile.close()
+ oldConfigFile.close()
+
+ if updated:
+ print "updated " + filename
+ os.rename(filename + ".new", filename)
+ os.chmod(filename, S_IMODE(mode))
+ elif warn:
+ print "warning: " + filename + " didn't contain any version"
+ os.unlink(filename + ".new")
+
+#
+# Replace all occurences of a regular expression in a file
+#
+def fileMatchAllAndReplace(filename, matchAndReplaceExps):
+
+ oldFile = open(filename, "r")
+ newFile = open(filename + ".new", "w")
+
+ #
+ # Compile the regular expressions
+ #
+ regexps = [ ]
+ for (regexp, replace) in matchAndReplaceExps:
+ regexps.append((re.compile(regexp), replace))
+
+ #
+ # Search for all lines with the given regular expressions and
+ # replace the matching string
+ #
+ updated = False
+ for line in oldFile.readlines():
+ for (regexp, replace) in regexps:
+ match = regexp.search(line)
+ if match != None:
+ oldLine = line
+ line = oldLine.replace(match.group(1), replace)
+ updated = True
+ newFile.write(line)
+
+ newFile.close()
+ oldFile.close()
+
+ if updated:
+ print "updated " + filename
+ os.rename(filename + ".new", filename)
+ else:
+ print "warning: " + filename + " didn't contain any version"
+ os.unlink(filename + ".new")
+
+def checkVersion(version):
+ if not re.match(vpatCheck, version):
+ print "invalid version number: " + version + " (it should have the form 3.2.1 or 3.2b or 3.2b2)"
+ sys.exit(0)
diff --git a/fixCopyright.py b/fixCopyright.py
index 940c24564b1..17b91ba387f 100755
--- a/fixCopyright.py
+++ b/fixCopyright.py
@@ -1,11 +1,7 @@
#!/usr/bin/env python
-import os, sys, shutil, fnmatch, re, glob
-from stat import *
+import os, sys, FixUtil
-#
-# Program usage.
-#
def usage():
print "Usage: " + sys.argv[0] + " [options]"
print
@@ -13,263 +9,6 @@ def usage():
print "-h Show this message."
print
-#
-# Returns the new copyright
-#
-def copyright(commentMark, patchIceE):
- result = [ ]
- result.append(commentMark + " **********************************************************************\n")
- result.append(commentMark + "\n")
- result.append(commentMark + " Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.\n")
- result.append(commentMark + "\n")
- if patchIceE == True:
- result.append(commentMark + " This copy of Ice-E is licensed to you under the terms described in the\n")
- result.append(commentMark + " ICEE_LICENSE file included in this distribution.\n")
- else:
- result.append(commentMark + " This copy of Ice is licensed to you under the terms described in the\n")
- result.append(commentMark + " ICE_LICENSE file included in this distribution.\n")
- result.append(commentMark + "\n")
- result.append(commentMark + " **********************************************************************\n")
- return result
-
-#
-# Replace one copyright
-#
-def replaceCopyright(file, commentMark, commentBegin, commentEnd, newCopyrightLines):
- oldFile = open(file, "r")
- oldLines = oldFile.readlines()
-
- done = 0
- commentFound = 0
- copyrightFound = 0
-
- beforeCopyrightLines = []
- oldCopyrightLines = []
- newLines = []
-
- justDone = 0
-
- if commentBegin == "":
- for x in oldLines:
- if not commentFound and (not x.startswith(commentMark) or x.startswith("#!/usr/bin/env")):
- beforeCopyrightLines.append(x)
- elif not done and x.startswith(commentMark):
- commentFound = 1
- if not copyrightFound and x.lower().find("copyright") != -1:
- copyrightFound = 1
- # skip this comment line
- oldCopyrightLines.append(x)
- else:
- if not done:
- done = 1
- justDone = 1
-
- # Eliminate double blank lines after copyright (bug introduced by previous fixCopyright script)
- if justDone == 1:
- newLines.append(x)
- if x != "\n":
- justDone = 0
- else:
- justDone = 2
- elif justDone == 2:
- if x != "\n":
- newLines.append(x)
- justDone = 0
- else:
- newLines.append(x)
- else:
- for x in oldLines:
- if not done:
- if x.startswith(commentBegin):
- commentFound = 1
- if commentFound:
- if not copyrightFound and x.find("Copyright") != -1:
- copyrightFound = 1
-
- # skip this comment line
- if x.find(commentEnd) != -1:
- done = 1
- justDone = 1
- else:
- beforeCopyrightLines.append(x)
- else:
- # Eliminate double blank lines after copyright (bug introduced by previous fixCopyright script)
- if justDone == 1:
- newLines.append(x)
- if x != "\n":
- justDone = 0
- else:
- justDone = 2
- elif justDone == 2:
- if x != "\n":
- newLines.append(x)
- justDone = 0
- else:
- newLines.append(x)
-
-
- oldFile.close()
-
- if copyrightFound and newCopyrightLines != oldCopyrightLines:
-
- mode = os.stat(file)[ST_MODE]
-
- origFile = file + ".orig"
- shutil.copy2(file, origFile)
-
- newFile = open(file, "w")
- newFile.writelines(beforeCopyrightLines)
- newFile.writelines(newCopyrightLines)
-
- #
- # Hack to keep the .err files
- #
- if fnmatch.fnmatch(file, "*test/Slice/errorDetection/*.ice") > 0:
- newFile.write("\n")
-
- newFile.writelines(newLines)
- newFile.close()
-
- os.chmod(file, S_IMODE(mode))
- print "------ Replaced copyright in " + file + " -------"
-
- #
- # Make sure Windows Makefiles are kept in DOS format.
- #
- if fnmatch.fnmatch(file, "*.mak*") or fnmatch.fnmatch(file, "*Make.rules.bcc") or fnmatch.fnmatch(file, "*Make.rules.msvc"):
- os.popen("unix2dos " + file);
-
- return copyrightFound
-
-#
-# Replace alls copyrights
-#
-def replaceAllCopyrights(path, patchIceE, recursive):
-
- cppCopyright = copyright("//", patchIceE)
- mcCopyright = copyright("; //", patchIceE)
- makefileCopyright = copyright("#", patchIceE)
- vbCopyright = copyright("'", patchIceE)
- pythonCopyright = makefileCopyright
- rubyCopyright = makefileCopyright
- xmlCopyright = []
- xmlCopyright.append("<!--\n");
- xmlCopyright.extend(copyright("", patchIceE))
- xmlCopyright.append("-->\n");
-
- files = os.listdir(path)
- for x in files:
- fullpath = os.path.join(path, x);
- if os.path.isdir(fullpath) and not os.path.islink(fullpath):
- if recursive:
- replaceAllCopyrights(fullpath, patchIceE, True)
- else:
-
- commentMark = ""
- commentBegin = ""
- commentEnd = ""
- copyrightLines = []
- skip = 0
-
- if x == "config" or x == ".depend" or x == ".dummy" or fnmatch.fnmatch(x, "*.dsp") or fnmatch.fnmatch(x, "*.sln") or fnmatch.fnmatch(x, "*.vdproj") or fnmatch.fnmatch(x, "*.err") or fnmatch.fnmatch(x, "*.class") or fnmatch.fnmatch(x, "*.ico") or fnmatch.fnmatch(x, "*.gif") or fnmatch.fnmatch(x, "*.jpg") or fnmatch.fnmatch(x, "*.orig"):
- print "Skipping file " + fullpath + ": no copyright needed"
- skip = 1
- elif fnmatch.fnmatch(x, "Make*") or fnmatch.fnmatch(x, "*.properties"):
- commentMark = "#"
- copyrightLines = makefileCopyright
- elif fnmatch.fnmatch(x, "*.h") or fnmatch.fnmatch(x, "*.cpp") or fnmatch.fnmatch(x, "*.cs") or fnmatch.fnmatch(x, "*.java") or fnmatch.fnmatch(x, "*.l") or fnmatch.fnmatch(x, "*.y"):
- commentMark = "//"
- copyrightLines = cppCopyright
- elif fnmatch.fnmatch(x, "*.ice") and not fnmatch.fnmatch(x, "IllegalIdentifier.ice"):
- commentMark = "//"
- copyrightLines = cppCopyright
- elif fnmatch.fnmatch(x, "*.py"):
- commentMark = "#"
- copyrightLines = pythonCopyright
- elif fnmatch.fnmatch(x, "*.def"):
- commentMark = "#"
- copyrightLines = pythonCopyright
- elif fnmatch.fnmatch(x, "*.cnf"):
- commentMark = "#"
- copyrightLines = pythonCopyright
- elif fnmatch.fnmatch(x, "*.rb"):
- commentMark = "#"
- copyrightLines = rubyCopyright
- elif fnmatch.fnmatch(x, "*.mc"):
- commentMark = "; //"
- copyrightLines = mcCopyright
- elif fnmatch.fnmatch(x, "*.vb"):
- commentMark = "'"
- copyrightLines = vbCopyright
- elif fnmatch.fnmatch(x, "*.xml"):
- commentBegin = "<!--"
- commentEnd = "-->"
- copyrightLines = xmlCopyright
- else:
- print "***** Skipping file " + fullpath + ": unknown type"
- skip = 1
-
- if not skip:
- if replaceCopyright(fullpath, commentMark, commentBegin, commentEnd, copyrightLines) == 0:
- print "***** WARNING: Did not find copyright in " + fullpath
-
-#
-# Find files matching a pattern.
-#
-def find(path, patt):
- result = [ ]
- files = os.listdir(path)
- for x in files:
- fullpath = os.path.join(path, x);
- if os.path.isdir(fullpath) and not os.path.islink(fullpath):
- result.extend(find(fullpath, patt))
- elif fnmatch.fnmatch(x, patt):
- result.append(fullpath)
- return result
-
-def fileMatchAndReplace(filename, matchAndReplaceExps, warn=True):
-
- mode = os.stat(filename)[ST_MODE]
- oldConfigFile = open(filename, "r")
- newConfigFile = open(filename + ".new", "w")
-
- #
- # Compile the regular expressions
- #
- regexps = [ ]
- for (regexp, replace) in matchAndReplaceExps:
- regexps.append((re.compile(regexp), replace))
-
- #
- # Search for the line with the given regular expressions and
- # replace the matching string
- #
- updated = False
- for line in oldConfigFile.readlines():
- for (regexp, replace) in regexps:
- match = regexp.search(line)
- if match != None:
- oldLine = line
- line = oldLine.replace(match.group(1), replace)
- updated = True
- break
- newConfigFile.write(line)
-
- newConfigFile.close()
- oldConfigFile.close()
-
- if updated:
- print "updated " + filename
- os.rename(filename + ".new", filename)
- os.chmod(filename, S_IMODE(mode))
- elif warn:
- print "warning: " + filename + " didn't contain any copyright"
- os.unlink(filename + ".new")
-
-#
-# Main
-#
-
for x in sys.argv[1:]:
if x == "-h":
usage()
@@ -282,46 +21,45 @@ for x in sys.argv[1:]:
ice_dir = os.path.normpath(os.path.join(os.path.dirname(__file__)))
+# **********************************************************************
#
-# Fix copyright header in files
+# Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
#
-replaceAllCopyrights(ice_dir, False, False)
-for dir in ["slice", "cpp", "java", "cs", "vb", "php", "py", "rb", "sl", "demoscript", "distribution", "config", "certs"]:
- home = os.path.join(ice_dir, dir)
- if home:
- replaceAllCopyrights(home, False, True)
-
-for dir in ["cppe", "javae"]:
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+FixUtil.replaceAllCopyrights(ice_dir, False, False)
+for dir in ["slice", "cpp", "java", "cs", "vb", "php", "py", "rb", "demoscript", "distribution", "config", "certs"]:
home = os.path.join(ice_dir, dir)
if home:
- replaceAllCopyrights(home, True, True)
+ FixUtil.replaceAllCopyrights(home, False, True)
#
# Fix various other files that have copyright info in them that
# are not taken care of above.
#
-vpatMatch = "20[0-9][0-9]-(20[0-9][0-9]) ZeroC"
+cpatMatch = "20[0-9][0-9]-(20[0-9][0-9]) ZeroC"
copyright = "2008"
-files = find(ice_dir, "*.rc")
-files += find(ice_dir, "*LICENSE")
-files += find(os.path.join(ice_dir, "cpp", "src"), "Gen.cpp")
-files += find(os.path.join(ice_dir, "cpp", "src"), "Parser.cpp")
-files += find(os.path.join(ice_dir, "cpp", "src", "Slice"), "*Util.cpp")
+files = FixUtil.find(ice_dir, "*.rc")
+files += FixUtil.find(ice_dir, "*LICENSE")
+files += FixUtil.find(os.path.join(ice_dir, "cpp", "src"), "Gen.cpp")
+files += FixUtil.find(os.path.join(ice_dir, "cpp", "src"), "Parser.cpp")
+files += FixUtil.find(os.path.join(ice_dir, "cpp", "src", "Slice"), "*Util.cpp")
files += [os.path.join(ice_dir, "cpp", "src", "ca", "iceca")]
files += [os.path.join(ice_dir, "cpp", "doc", "symboltree.js")]
files += [os.path.join(ice_dir, "cpp", "demo", "Freeze", "backup", "backup")]
-files += find(os.path.join(ice_dir, "cpp"), "*.bat")
+files += FixUtil.find(os.path.join(ice_dir, "cpp"), "*.bat")
files += [os.path.join(ice_dir, "cpp", "test", "IceSSL", "certs", "makecerts")]
files += [os.path.join(ice_dir, "java", "bin", "icegridgui.rpm")]
files += [os.path.join(ice_dir, "java", "src", "IceGridGUI", "Coordinator.java")]
-files += find(os.path.join(ice_dir, "java", "resources", "IceGridAdmin"), "icegridadmin_content_*.html")
+files += FixUtil.find(os.path.join(ice_dir, "java", "resources", "IceGridAdmin"), "icegridadmin_content_*.html")
files += [os.path.join(ice_dir, "config", "makeprops.py")]
-files += find(os.path.join(ice_dir), "AssemblyInfo.cs")
-files += find(os.path.join(ice_dir, "sl"), "*.as*x")
-files += find(os.path.join(ice_dir, "distribution", "src", "rpm"), "*")
-files += find(os.path.join(ice_dir, "php"), "*.php")
+files += FixUtil.find(os.path.join(ice_dir), "AssemblyInfo.cs")
+files += FixUtil.find(os.path.join(ice_dir, "distribution", "src", "rpm"), "*")
+files += FixUtil.find(os.path.join(ice_dir, "php"), "*.php")
files += [os.path.join(ice_dir, "cpp", "test", "Slice", "errorDetection", "IllegalIdentifier.ice")]
for f in files:
- fileMatchAndReplace(f, [(vpatMatch, copyright)])
+ FixUtil.fileMatchAndReplace(f, [(cpatMatch, copyright)])
diff --git a/fixVersion.py b/fixVersion.py
index 2171fbc29d2..26a0df84d95 100755
--- a/fixVersion.py
+++ b/fixVersion.py
@@ -1,203 +1,20 @@
#!/usr/bin/env python
-import os, sys, shutil, fnmatch, re, glob, getopt
+import os, sys, getopt, FixUtil
-#
-# version pattern
-#
-vpatCheck = "[0-9]+\.[0-9]+(\.[0-9]+|b[0-9]*)$"
-vpatParse = "([0-9]+)\.([0-9]+)(\.[0-9]+|b[0-9]*)"
-vpatMatch = "([0-9]+\.[0-9]+(\.[0-9]+|b[0-9]*))"
-
-#
-# Program usage.
-#
def usage():
- print "Usage: " + sys.argv[0] + " [-e] version"
+ print "Usage: " + sys.argv[0] + " version"
print
print "Options:"
- print "-e Fix version for Ice-E instead of Ice."
print "-h, --help Show this message."
print
-
-def commaVersion(version):
- major = majorVersion(version)
- minor = minorVersion(version)
- patch = patchVersion(version)
- return ("%s,%s,%s" % (major, minor, patch))
-
-def intVersion(version):
- r = re.search(vpatParse, version)
- major = int(r.group(1))
- minor = int(r.group(2))
- gr3 = r.group(3)
- patch = -1
- if gr3.startswith("."):
- patch = int(gr3[1:])
- else:
- if len(gr3) > 1:
- patch = 50 + int(gr3[1:])
- else:
- patch = 51
- return ("%2d%02d%02d" % (major, minor, patch)).strip()
-
-def betaVersion(version):
- r = re.search(vpatParse, version)
- if r.group(3).startswith("b"):
- return "b"
- else:
- return ""
-
-def soVersion(version):
- r = re.search(vpatParse, version)
- major = int(r.group(1))
- minor = int(r.group(2))
- v = ("%d%d" % (major, minor)).strip()
- if r.group(3).startswith("b"):
- return v + "b"
- else:
- return v
-
-def majorVersion(version):
- r = re.search(vpatParse, version)
- major = int(r.group(1))
- return ("%d" % (major)).strip()
-
-def minorVersion(version):
- r = re.search(vpatParse, version)
- minor = int(r.group(2))
- return ("%d" % (minor)).strip()
-
-def shortVersion(version):
- r = re.search(vpatParse, version)
- major = int(r.group(1))
- minor = int(r.group(2))
- return ("%d.%d" % (major, minor)).strip()
-
-def patchVersion(version):
- r = re.search(vpatParse, version)
-
- gr3 = r.group(3)
- patch = -1
- if gr3.startswith("."):
- patch = int(gr3[1:])
- else:
- if len(gr3) > 1:
- patch = 50 + int(gr3[1:])
- else:
- patch = 51
-
- return ("%d" % (patch)).strip()
-
-#
-# Find files matching a pattern.
-#
-def find(path, patt):
- result = [ ]
- files = os.listdir(path)
- for x in files:
- fullpath = os.path.join(path, x);
- if os.path.isdir(fullpath) and not os.path.islink(fullpath):
- result.extend(find(fullpath, patt))
- elif fnmatch.fnmatch(x, patt):
- result.append(fullpath)
- return result
-
-
-#
-# Replace a string matched by the first group of regular expression.
-#
-# For example: the regular expression "ICE_STRING_VERSION \"([0-9]*\.[0-9]*\.[0-9]*)\""
-# will match the string version in "ICE_STRING_VERSION "2.1.0"" and will replace it with
-# the given version.
-#
-def fileMatchAndReplace(filename, matchAndReplaceExps, warn=True):
-
- mode = os.stat(filename)[ST_MODE]
- oldConfigFile = open(filename, "r")
- newConfigFile = open(filename + ".new", "w")
-
- #
- # Compile the regular expressions
- #
- regexps = [ ]
- for (regexp, replace) in matchAndReplaceExps:
- regexps.append((re.compile(regexp), replace))
-
- #
- # Search for the line with the given regular expressions and
- # replace the matching string
- #
- updated = False
- for line in oldConfigFile.readlines():
- for (regexp, replace) in regexps:
- match = regexp.search(line)
- if match != None:
- oldLine = line
- line = oldLine.replace(match.group(1), replace)
-# print oldLine + line
- updated = True
- break
- newConfigFile.write(line)
-
- newConfigFile.close()
- oldConfigFile.close()
-
- if updated:
- print "updated " + filename
- os.rename(filename + ".new", filename)
- os.chmod(filename, S_IMODE(mode))
- elif warn:
- print "warning: " + filename + " didn't contain any version"
- os.unlink(filename + ".new")
-
-#
-# Replace all occurences of a regular expression in a file
-#
-def fileMatchAllAndReplace(filename, matchAndReplaceExps):
-
- oldFile = open(filename, "r")
- newFile = open(filename + ".new", "w")
-
- #
- # Compile the regular expressions
- #
- regexps = [ ]
- for (regexp, replace) in matchAndReplaceExps:
- regexps.append((re.compile(regexp), replace))
-
- #
- # Search for all lines with the given regular expressions and
- # replace the matching string
- #
- updated = False
- for line in oldFile.readlines():
- for (regexp, replace) in regexps:
- match = regexp.search(line)
- if match != None:
- oldLine = line
- line = oldLine.replace(match.group(1), replace)
- updated = True
- newFile.write(line)
-
- newFile.close()
- oldFile.close()
-
- if updated:
- print "updated " + filename
- os.rename(filename + ".new", filename)
- else:
- print "warning: " + filename + " didn't contain any version"
- os.unlink(filename + ".new")
-
if len(sys.argv) < 2:
usage()
sys.exit(0)
-patchIceE = False
try:
- opts, args = getopt.getopt(sys.argv[1:], "he", ["help"])
+ opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
except getopt.GetoptError:
usage()
sys.exit(1)
@@ -205,8 +22,6 @@ for o, a in opts:
if o in ("-h", "--help"):
usage()
sys.exit(0)
- if o in ("-e"):
- patchIceE = True
if len(args) != 1:
usage()
sys.exit(1)
@@ -214,199 +29,162 @@ if len(args) != 1:
version = args[0]
ice_dir = os.path.normpath(os.path.join(os.path.dirname(__file__)))
-if not re.match(vpatCheck, version):
- print "invalid version number: " + version + " (it should have the form 3.2.1 or 3.2b or 3.2b2)"
- sys.exit(0)
+FixUtil.checkVersion(version)
-if not patchIceE:
- fileMatchAndReplace(os.path.join(ice_dir, "config", "Make.common.rules"),
- [("VERSION_MAJOR[\t\s]*= ([0-9]*)", majorVersion(version)),
- ("VERSION_MINOR[\t\s]*= ([0-9]*b?)", minorVersion(version) + betaVersion(version)),
- ("SHORT_VERSION[\t\s]*= ([0-9]*\.[0-9]*)", shortVersion(version)),
- ("VERSION[\t\s]*= " + vpatMatch, version),
- ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
-
- fileMatchAndReplace(os.path.join(ice_dir, "config", "Make.common.rules.mak"),
- [("^VERSION[\t\s]*= " + vpatMatch, version),
- ("INTVERSION[\t\s]*= " + vpatMatch, majorVersion(version) + "." + minorVersion(version) + \
- "." + patchVersion(version)),
- ("SHORT_VERSION[\t\s]*= ([0-9]*\.[0-9]*)", shortVersion(version)),
- ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
-
- fileMatchAndReplace(os.path.join(ice_dir, "distribution", "src", "rpm", "ice.spec"),
- [("Version: " + vpatMatch, version)])
- fileMatchAndReplace(os.path.join(ice_dir, "distribution", "src", "rpm", "ice.spec"),
- [("%define soversion ([0-9]+b?)", soVersion(version))])
- fileMatchAndReplace(os.path.join(ice_dir, "distribution", "src", "rpm", "ice.spec"),
- [("%define dotnetversion ([0-9]*\.[0-9]*\.[0-9]*)",
- majorVersion(version) + "." + minorVersion(version) + "." + patchVersion(version))])
-
-
- #
- # Fix version in C++ sources
- #
- ice_home = os.path.join(ice_dir, "cpp")
- if ice_home:
- fileMatchAndReplace(os.path.join(ice_home, "include", "IceUtil", "Config.h"),
- [("ICE_STRING_VERSION \"" + vpatMatch + "\"", version), \
- ("ICE_INT_VERSION ([0-9]*)", intVersion(version))])
-
- fileMatchAndReplace(os.path.join(ice_home, "src", "ca", "iceca"),
- [("Ice-" + vpatMatch, version)])
- os.system("chmod 755 " + os.path.join(ice_home, "src", "ca", "iceca"))
-
- fileMatchAndReplace(os.path.join(ice_home, "doc", "swish", "swish.conf"),
- [("doc/Ice-" + vpatMatch, version)])
-
- fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "clock", "config.icebox"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
-
- fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "counter", "config.icebox"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
-
- fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "replicated2", "config.ib1"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
- fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "replicated2", "config.ib2"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
- fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "replicated2", "config.ib3"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
-
- fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "replicated", "application.xml"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
-
- fileMatchAndReplace(os.path.join(ice_home, "config", "templates.xml"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
-
- fileMatchAndReplace(os.path.join(ice_home, "test", "IceStorm", "repgrid", "application.xml"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
-
- for f in find(os.path.join(ice_home, "src"), "*.rc"):
- fileMatchAndReplace(f, [("\"FileVersion\", \"" + vpatMatch, version), \
- ("\"ProductVersion\", \"" + vpatMatch, version), \
- ("INTERNALNAME \"[^0-9]*2?([0-9][0-9]b?)d?", soVersion(version)), \
- ("ORIGINALFILENAME \"[^0-9]*2?([0-9][0-9]b?)d?\.dll", soVersion(version)), \
- ("FILEVERSION ([0-9]+,[0-9]+,[0-9]+)", commaVersion(version)), \
- ("PRODUCTVERSION ([0-9]+,[0-9]+,[0-9]+)", commaVersion(version))])
-
- #
- # Fix version in Java sources
- #
- icej_home = os.path.join(ice_dir, "java")
- if icej_home:
- fileMatchAndReplace(os.path.join(icej_home, "config", "build.properties"),
- [("ice\.version[\t\s]*= " + vpatMatch, version)])
-
- fileMatchAndReplace(os.path.join(icej_home, "src", "IceUtil", "Version.java"),
- [("ICE_STRING_VERSION = \"" + vpatMatch +"\"", version), \
- ("ICE_INT_VERSION = ([0-9]*)", intVersion(version))])
-
- fileMatchAndReplace(os.path.join(icej_home, "src", "Ice", "Util.java"),
- [("return \"" + vpatMatch +"\".*A=major", version), \
- ("return ([0-9]*).*AA=major", intVersion(version))])
-
- fileMatchAndReplace(os.path.join(icej_home, "demo", "IceStorm", "clock", "config.icebox"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
-
- #
- # Fix version in C# sources
- #
- icecs_home = os.path.join(ice_dir, "cs")
- if icecs_home:
- for f in find(icecs_home, "AssemblyInfo.cs"):
- if f.find("generate") < 0 and f.find("ConsoleApplication") < 0:
- fileMatchAndReplace(f, [("AssemblyVersion\(\"" + vpatMatch + "\"",
- majorVersion(version) + "." + minorVersion(version) + "." + \
- patchVersion(version))])
-
- fileMatchAndReplace(os.path.join(icecs_home, "demo", "IceStorm", "clock", "config.icebox"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
-
- for f in find(icecs_home, "*.pc"):
- print "matching " + f
- fileMatchAndReplace(f, [("[\t\s]*version[\t\s]*=[\t\s]* " + vpatMatch, majorVersion(version) + "." + \
- minorVersion(version) + "." + patchVersion(version))])
-
- for f in find(icecs_home, "config*"):
- print "matching " + f
- fileMatchAndReplace(f,
- [("Version=*([0-9]*\.[0-9]*\.[0-9]*).0",
- majorVersion(version) + "." + minorVersion(version) + "." + patchVersion(version))],
- False) # Disable warnings as many files might not have SSL configuration
-
- fileMatchAndReplace(os.path.join(icecs_home, "src", "Ice", "Util.cs"),
- [("return \"" + vpatMatch +"\".*A=major", version), \
- ("return ([0-9]*).*AA=major", intVersion(version))])
-
-
- #
- # Fix version in VB sources
- #
- icevb_home = os.path.join(ice_dir, "vb")
- if icevb_home:
- fileMatchAndReplace(os.path.join(icevb_home, "demo", "IceStorm", "clock", "config.icebox"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
-
- for f in find(icevb_home, "config*"):
- print "matching " + f
- fileMatchAndReplace(f,
- [("Version=*([0-9]*\.[0-9]*\.[0-9]*).0",
- majorVersion(version) + "." + minorVersion(version) + "." + patchVersion(version))],
- False) # Disable warnings as many files might not have SSL configuration
-
- #
- # Fix version in PHP sources
- #
- #icephp_home = os.path.join(ice_dir, "php")
- #if icephp_home:
-
- #
- # Fix version in IcePy
- #
- icepy_home = os.path.join(ice_dir, "py")
- if icepy_home:
- fileMatchAndReplace(os.path.join(icepy_home, "demo", "IceStorm", "clock", "config.icebox"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
-
- fileMatchAndReplace(os.path.join(icepy_home, "demo", "Ice", "bidir", "Server.py"),
- [("Ice-" + vpatMatch, version)])
- fileMatchAndReplace(os.path.join(icepy_home, "demo", "Ice", "bidir", "Client.py"),
- [("Ice-" + vpatMatch, version)])
-
- #
- # Fix version in IceRuby
- #
- #icerb_home = os.path.join(ice_dir, "rb")
- #if icerb_home:
+FixUtil.fileMatchAndReplace(os.path.join(ice_dir, "config", "Make.common.rules"),
+ [("VERSION_MAJOR[\t\s]*= ([0-9]*)", FixUtil.majorVersion(version)),
+ ("VERSION_MINOR[\t\s]*= ([0-9]*b?)", FixUtil.minorVersion(version) + FixUtil.betaVersion(version)),
+ ("SHORT_VERSION[\t\s]*= ([0-9]*\.[0-9]*)", FixUtil.shortVersion(version)),
+ ("VERSION[\t\s]*= " + FixUtil.vpatMatch, version),
+ ("SOVERSION[\t\s]*= ([0-9]+b?)", FixUtil.soVersion(version))])
+
+FixUtil.fileMatchAndReplace(os.path.join(ice_dir, "config", "Make.common.rules.mak"),
+ [("^VERSION[\t\s]*= " + FixUtil.vpatMatch, version),
+ ("INTVERSION[\t\s]*= " + FixUtil.vpatMatch, FixUtil.majorVersion(version) + "." + FixUtil.minorVersion(version) + \
+ "." + FixUtil.patchVersion(version)),
+ ("SHORT_VERSION[\t\s]*= ([0-9]*\.[0-9]*)", FixUtil.shortVersion(version)),
+ ("SOVERSION[\t\s]*= ([0-9]+b?)", FixUtil.soVersion(version))])
+
+FixUtil.fileMatchAndReplace(os.path.join(ice_dir, "distribution", "src", "rpm", "ice.spec"),
+ [("Version: " + FixUtil.vpatMatch, version)])
+FixUtil.fileMatchAndReplace(os.path.join(ice_dir, "distribution", "src", "rpm", "ice.spec"),
+ [("%define soversion ([0-9]+b?)", FixUtil.soVersion(version))])
+FixUtil.fileMatchAndReplace(os.path.join(ice_dir, "distribution", "src", "rpm", "ice.spec"),
+ [("%define dotnetversion ([0-9]*\.[0-9]*\.[0-9]*)",
+ FixUtil.majorVersion(version) + "." + FixUtil.minorVersion(version) + "." + FixUtil.patchVersion(version))])
- sys.exit(0)
#
-# Fix version in Ice-E sources
+# Fix version in C++ sources
#
-icee_home = os.path.join(ice_dir, "cppe")
-if icee_home:
- fileMatchAndReplace(os.path.join(icee_home, "include", "IceE", "Config.h"),
- [("ICEE_STRING_VERSION \"([0-9]*\.[0-9]*\.[0-9]*)\"", version), \
- ("ICEE_INT_VERSION ([0-9]*)", intVersion(version))])
-
- fileMatchAndReplace(os.path.join(icee_home, "config", "Make.rules"),
- [("VERSION[\t\s]*= ([0-9]*\.[0-9]*\.[0-9]*)", version),
- ("SOVERSION[\t\s]*= ([0-9]*)", soVersion(version))])
+ice_home = os.path.join(ice_dir, "cpp")
+if ice_home:
+ FixUtil.fileMatchAndReplace(os.path.join(ice_home, "include", "IceUtil", "Config.h"),
+ [("ICE_STRING_VERSION \"" + FixUtil.vpatMatch + "\"", version), \
+ ("ICE_INT_VERSION ([0-9]*)", FixUtil.intVersion(version))])
+
+ FixUtil.fileMatchAndReplace(os.path.join(ice_home, "src", "ca", "iceca"),
+ [("Ice-" + FixUtil.vpatMatch, version)])
+
+ FixUtil.fileMatchAndReplace(os.path.join(ice_home, "doc", "swish", "swish.conf"),
+ [("doc/Ice-" + FixUtil.vpatMatch, version)])
+
+ FixUtil.fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "clock", "config.icebox"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+
+ FixUtil.fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "counter", "config.icebox"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+
+ FixUtil.fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "replicated2", "config.ib1"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+ FixUtil.fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "replicated2", "config.ib2"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+ FixUtil.fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "replicated2", "config.ib3"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+
+ FixUtil.fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "replicated", "application.xml"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+
+ FixUtil.fileMatchAndReplace(os.path.join(ice_home, "config", "templates.xml"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+
+ FixUtil.fileMatchAndReplace(os.path.join(ice_home, "test", "IceStorm", "repgrid", "application.xml"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+
+ for f in find(os.path.join(ice_home, "src"), "*.rc"):
+ FixUtil.fileMatchAndReplace(f, [("\"FileVersion\", \"" + FixUtil.vpatMatch, version), \
+ ("\"ProductVersion\", \"" + FixUtil.vpatMatch, version), \
+ ("INTERNALNAME \"[^0-9]*2?([0-9][0-9]b?)d?", FixUtil.soVersion(version)), \
+ ("ORIGINALFILENAME \"[^0-9]*2?([0-9][0-9]b?)d?\.dll", FixUtil.soVersion(version)), \
+ ("FILEVERSION ([0-9]+,[0-9]+,[0-9]+)", commaVersion(version)), \
+ ("PRODUCTVERSION ([0-9]+,[0-9]+,[0-9]+)", commaVersion(version))])
- fileMatchAllAndReplace(os.path.join(icee_home, "src", "IceE", "ice.dsp"),
- [("icee([0-9][0-9])d?\.((dll)|(pdb))", soVersion(version))])
- fileMatchAllAndReplace(os.path.join(icee_home, "src", "IceEC", "icec.dsp"),
- [("iceec([0-9][0-9])d?\.((dll)|(pdb))", soVersion(version))])
- fileMatchAllAndReplace(os.path.join(icee_home, "test", "Common", "testCommon.dsp"),
- [("testCommon([0-9][0-9])d?\.((dll)|(pdb))", soVersion(version))])
+#
+# Fix version in Java sources
+#
+icej_home = os.path.join(ice_dir, "java")
+if icej_home:
+ FixUtil.fileMatchAndReplace(os.path.join(icej_home, "config", "build.properties"),
+ [("ice\.version[\t\s]*= " + FixUtil.vpatMatch, version)])
+
+ FixUtil.fileMatchAndReplace(os.path.join(icej_home, "src", "IceUtil", "Version.java"),
+ [("ICE_STRING_VERSION = \"" + FixUtil.vpatMatch +"\"", version), \
+ ("ICE_INT_VERSION = ([0-9]*)", FixUtil.intVersion(version))])
+
+ FixUtil.fileMatchAndReplace(os.path.join(icej_home, "src", "Ice", "Util.java"),
+ [("return \"" + FixUtil.vpatMatch +"\".*A=major", version), \
+ ("return ([0-9]*).*AA=major", FixUtil.intVersion(version))])
+
+ FixUtil.fileMatchAndReplace(os.path.join(icej_home, "demo", "IceStorm", "clock", "config.icebox"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+
+#
+# Fix version in C# sources
+#
+icecs_home = os.path.join(ice_dir, "cs")
+if icecs_home:
+ for f in find(icecs_home, "AssemblyInfo.cs"):
+ if f.find("generate") < 0 and f.find("ConsoleApplication") < 0:
+ FixUtil.fileMatchAndReplace(f, [("AssemblyVersion\(\"" + FixUtil.vpatMatch + "\"",
+ FixUtil.majorVersion(version) + "." + FixUtil.minorVersion(version) + "." + \
+ FixUtil.patchVersion(version))])
+
+ FixUtil.fileMatchAndReplace(os.path.join(icecs_home, "demo", "IceStorm", "clock", "config.icebox"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+
+ for f in find(icecs_home, "*.pc"):
+ print "matching " + f
+ FixUtil.fileMatchAndReplace(f, [("[\t\s]*version[\t\s]*=[\t\s]* " + FixUtil.vpatMatch, FixUtil.majorVersion(version) + "." + \
+ FixUtil.minorVersion(version) + "." + FixUtil.patchVersion(version))])
+
+ for f in find(icecs_home, "config*"):
+ print "matching " + f
+ FixUtil.fileMatchAndReplace(f,
+ [("Version=*([0-9]*\.[0-9]*\.[0-9]*).0",
+ FixUtil.majorVersion(version) + "." + FixUtil.minorVersion(version) + "." + FixUtil.patchVersion(version))],
+ False) # Disable warnings as many files might not have SSL configuration
+
+ FixUtil.fileMatchAndReplace(os.path.join(icecs_home, "src", "Ice", "Util.cs"),
+ [("return \"" + FixUtil.vpatMatch +"\".*A=major", version), \
+ ("return ([0-9]*).*AA=major", FixUtil.intVersion(version))])
+
+#
+# Fix version in VB sources
+#
+icevb_home = os.path.join(ice_dir, "vb")
+if icevb_home:
+ FixUtil.fileMatchAndReplace(os.path.join(icevb_home, "demo", "IceStorm", "clock", "config.icebox"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+
+ for f in find(icevb_home, "config*"):
+ print "matching " + f
+ FixUtil.fileMatchAndReplace(f,
+ [("Version=*([0-9]*\.[0-9]*\.[0-9]*).0",
+ FixUtil.majorVersion(version) + "." + FixUtil.minorVersion(version) + "." + FixUtil.patchVersion(version))],
+ False) # Disable warnings as many files might not have SSL configuration
+
+#
+# Fix version in PHP sources
#
-# Fix version in IceJ sources
+#icephp_home = os.path.join(ice_dir, "php")
+#if icephp_home:
+
+#
+# Fix version in IcePy
#
-iceje_home = os.path.join(ice_dir, "javae")
-if iceje_home:
- fileMatchAndReplace(os.path.join(iceje_home, "src", "IceUtil", "Version.java"),
- [("ICEE_STRING_VERSION = \"([0-9]*\.[0-9]*\.[0-9]*)\"", version), \
- ("ICEE_INT_VERSION = ([0-9]*)", intVersion(version))])
+icepy_home = os.path.join(ice_dir, "py")
+if icepy_home:
+ FixUtil.fileMatchAndReplace(os.path.join(icepy_home, "demo", "IceStorm", "clock", "config.icebox"),
+ [("IceStormService,([0-9]+b?)", FixUtil.soVersion(version))])
+
+ FixUtil.fileMatchAndReplace(os.path.join(icepy_home, "demo", "Ice", "bidir", "Server.py"),
+ [("Ice-" + FixUtil.vpatMatch, version)])
+ FixUtil.fileMatchAndReplace(os.path.join(icepy_home, "demo", "Ice", "bidir", "Client.py"),
+ [("Ice-" + FixUtil.vpatMatch, version)])
-sys.exit(0)
+#
+# Fix version in IceRuby
+#
+#icerb_home = os.path.join(ice_dir, "rb")
+#if icerb_home: