summaryrefslogtreecommitdiff
path: root/jam-files/engine/bump_version.py
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-05-13 03:35:30 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-05-13 03:35:30 +0200
commitd94373453c69c6cfec952a0f7b427cacc78654d8 (patch)
tree43febdf719c103d19bd5d22d0be734e1574bc1e9 /jam-files/engine/bump_version.py
parentcc9650b8b664d1f6836a0fa86a012401b51aafa0 (diff)
parenta65a80c5d5b6fc4cbd32280f07cae9be71551b70 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'jam-files/engine/bump_version.py')
-rw-r--r--jam-files/engine/bump_version.py80
1 files changed, 80 insertions, 0 deletions
diff --git a/jam-files/engine/bump_version.py b/jam-files/engine/bump_version.py
new file mode 100644
index 00000000..9423c4c7
--- /dev/null
+++ b/jam-files/engine/bump_version.py
@@ -0,0 +1,80 @@
+#!/usr/bin/python
+
+# This script is used to bump version of bjam. It takes a single argument, e.g
+#
+# ./bump_version.py 3.1.9
+#
+# and updates all necessary files. For the time being, it's assumes presense
+# of 'perl' executable and Debian-specific 'dch' executable.
+#
+
+
+import os
+import os.path
+import re
+import string
+import sys
+
+srcdir = os.path.abspath(os.path.dirname(__file__ ))
+docdir = os.path.abspath(os.path.join(srcdir,"..","doc"))
+
+def edit(file,replacements):
+ print " '%s'..." %(file)
+ text = open(file,'r').read()
+ while len(replacements) > 0:
+ #~ print " '%s' ==> '%s'" % (replacements[0],replacements[1])
+ text = re.compile(replacements[0],re.M).subn(replacements[1],text)[0]
+ replacements = replacements[2:]
+ #~ print text
+ open(file,'w').write(text)
+
+def make_edits(version):
+ edit(os.path.join(srcdir,"boost-jam.spec"), [
+ '^Version:.*$','Version: %s' % string.join(version, "."),
+ ])
+
+ edit(os.path.join(srcdir,"build.jam"), [
+ '^_VERSION_ = .* ;$','_VERSION_ = %s %s %s ;' % (version[0], version[1], version[2]),
+ ])
+
+ edit(os.path.join(docdir,"bjam.qbk"), [
+ '\[version.*\]','[version: %s]' % string.join(version, '.'),
+ '\[def :version:.*\]','[def :version: %s]' % string.join(version, '.'),
+ ])
+
+ edit(os.path.join(srcdir,"patchlevel.h"), [
+ '^#define VERSION_MAJOR .*$',
+ '#define VERSION_MAJOR %s' % (version[0]),
+ '^#define VERSION_MINOR .*$',
+ '#define VERSION_MINOR %s' % (version[1]),
+ '^#define VERSION_PATCH .*$',
+ '#define VERSION_PATCH %s' % (version[2]),
+ '^#define VERSION_MAJOR_SYM .*$',
+ '#define VERSION_MAJOR_SYM "0%s"' % (version[0]),
+ '^#define VERSION_MINOR_SYM .*$',
+ '#define VERSION_MINOR_SYM "%s"' % (version[1]),
+ '^#define VERSION_PATCH_SYM .*$',
+ '#define VERSION_PATCH_SYM "%s"' % (version[2]),
+ '^#define VERSION .*$',
+ '#define VERSION "%s"' % string.join(version, '.'),
+ '^#define JAMVERSYM .*$',
+ '#define JAMVERSYM "JAMVERSION=%s.%s"' % (version[0],version[1]),
+ ])
+
+def main():
+
+ if len(sys.argv) < 2:
+ print "Expect new version as argument"
+ sys.exit(1)
+
+ version = string.split(sys.argv[1], ".")
+ print "Setting version to", version
+ make_edits(version)
+
+if __name__ == '__main__':
+ main()
+
+#~ Copyright 2006 Rene Rivera.
+#~ Copyright 2005-2006 Vladimir Prus.
+#~ Distributed under the Boost Software License, Version 1.0.
+#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)