~abentley/bzrtools/bzrtools.dev

568 by Aaron Bentley
Don't check version when running non-bzrtools commands
1
#!/usr/bin/env python
459 by Aaron Bentley
Add script for automated releases
2
import os
3
import re
568 by Aaron Bentley
Don't check version when running non-bzrtools commands
4
from subprocess import call, PIPE
459 by Aaron Bentley
Add script for automated releases
5
import sys
6
7
sys.path.insert(0, '..')
8
sys.path.insert(0, os.path.dirname(os.path.realpath('/home/abentley/bin/bzr')))
9
import bzrtools
10
print "bzrtools version: %s" % bzrtools.__version__
11
def minigrep(pattern, filename):
12
    setup = open(filename, 'rb')
13
    for line in setup:
14
        match = re.search(pattern, line)
15
        if match is not None:
16
            return match
531.2.2 by Charlie Shepherd
Remove all trailing whitespace
17
459 by Aaron Bentley
Add script for automated releases
18
newsmatch = minigrep('RELEASE: bzrtools %s' % (bzrtools.__version__), 'NEWS')
19
if newsmatch is None:
20
    print "NEWS entry missing"
21
    sys.exit(1)
22
else:
23
    print "NEWS entry found"
660 by Aaron Bentley
Update target for release script
24
final_name = '../bzrtools-release/bzrtools-%s.tar.gz' % bzrtools.__version__
459 by Aaron Bentley
Add script for automated releases
25
if os.path.exists('../bzrtools.tar.gz'):
26
    print "Temp file exists already."
27
    sys.exit(1)
28
if os.path.exists(final_name):
29
    print "Final file exists already."
30
    sys.exit(1)
568 by Aaron Bentley
Don't check version when running non-bzrtools commands
31
if call(['bzr', 'diff'], stdout=PIPE) != 0:
517 by Aaron Bentley
Release script checks for uncommitted changes
32
    print "Please commit before releasing"
33
    sys.exit(1)
617 by Aaron Bentley
Add tagging to release script
34
retcode = call(['bzr', 'tag', 'release-%s' % bzrtools.__version__])
35
if retcode != 0:
36
    sys.exit(1)
459 by Aaron Bentley
Add script for automated releases
37
retcode = call(['bzr', 'export', '../bzrtools.tar.gz'])
38
if retcode != 0:
39
    sys.exit(1)
40
os.rename('../bzrtools.tar.gz', final_name)
41
print 'Created %s' % final_name
42
call(['gpg', '--detach-sign', final_name])
616 by Aaron Bentley
Update release script
43
#print 'Uploading...'
614 by Aaron Bentley
Release 1.2.0
44
#call(['scp', final_name, final_name + '.sig',
45
#      'panoramicfeedback.com:opensource/'])