1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/usr/bin/python
import os
import sys
import datetime
import shutil
import version
import argparse
parser = argparse.ArgumentParser(description = "Build and tag a release.")
parser.add_argument('-f', '--full', dest='full', action='store_const', const=True, help="full release", default=False)
parser.add_argument('-b', '--beta', dest='beta', action='store_const', const=True, help="beta release", default=False)
parser.add_argument('-d', '--debug', dest='debug', action='store_const', const=True, help="show commands but don't do anything", default=False)
args = parser.parse_args()
if not args.full and not args.beta:
print "%s: must specify --full or --beta" % sys.argv[0]
sys.exit(1)
def command(c):
if not args.debug:
os.system(c)
print c
def check_diff_with_user():
print "Planning to commit... ok? [y/n]"
command("git diff")
if (raw_input() != "y"):
command("git reset --hard")
print 'Aborted'
sys.exit(1)
if not args.debug and os.popen('git status -s').read() != '':
print '%s: uncommitted changes exist.' % sys.argv[0]
sys.exit(1)
m = version.Version.to_release
if args.beta:
m = version.Version.bump_beta
new_version = version.rewrite_wscript(m)
version.append_to_changelog(new_version)
command("dch -b -v %s-1 \"New upstream release.\"" % new_version)
command("./waf clean")
command("./waf dist")
check_diff_with_user()
command("git commit -a -m \"Bump version\"")
command("git tag -m \"v%s\" v%s" % (new_version, new_version))
if args.full:
version.rewrite_wscript(version.Version.bump_and_to_pre)
check_diff_with_user()
command("git commit -a -m \"Bump version\"")
|