Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/build/jam_src/bump_version.py @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/usr/bin/python
2
3# This script is used to bump version of bjam. It takes a single argument, e.g
4#
5#    ./bump_version.py 3.1.9
6#
7# and updates all necessary files. For the time being, it's assumes presense
8# of 'perl' executable and Debian-specific 'dch' executable.
9#
10 
11
12import sys
13import string
14import os
15
16def spec(version):
17    os.system("perl -pi -e 's|^Version:.*|Version: %s|' boost-jam.spec" %
18              string.join(version, "."))
19
20def build_jam(version):
21    os.system("perl -pi -e 's|^VERSION = .* ;|VERSION = %s\$(.)%s\$(.)%s ;|' build.jam"
22              % (version[0], version[1], version[2]))
23
24def index_html(version):
25    os.system("perl -pi -e 's|This is version .* of BJam|This is version %s of BJam|' index.html"
26              % string.join(version, "."))
27
28def jam_c(version):
29    re = "\\*major_version = .*, \\*minor_version = .*, \\*changenum = .*";
30    new = ('*major_version = "%02d", *minor_version = "%02d", *changenum = "%02d";' %
31        (int(version[0]), int(version[1]), int(version[2])))
32    os.system("perl -pi -e 's|%s|%s|' jam.c" % (re, new))
33
34def patchlevel(version):
35    os.system("perl -pi -e 's|VERSION .*|VERSION \"%s\"|' patchlevel.h" %
36              string.join(version, "."))
37
38def dch(version):
39    os.system("dch --ignore-dirname -v " + string.join(version, ".") + "-1")
40       
41bumpers = [spec, build_jam, index_html, jam_c, patchlevel, dch]
42
43def main():
44
45    if len(sys.argv) < 2:
46        print "Expect new version as argument"
47        sys.exit(1)
48               
49    new_version = string.split(sys.argv[1], ".")
50    print "Setting version to", new_version
51    for b in bumpers:
52        b(new_version)
53
54if __name__ == '__main__':
55    main()
Note: See TracBrowser for help on using the repository browser.