~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
722 by Aaron Bentley
Update release script to use plugins directory.
7
sys.path.insert(0, '/home/abentley/bzrplugins')
459 by Aaron Bentley
Add script for automated releases
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"
568 by Aaron Bentley
Don't check version when running non-bzrtools commands
24
if call(['bzr', 'diff'], stdout=PIPE) != 0:
517 by Aaron Bentley
Release script checks for uncommitted changes
25
    print "Please commit before releasing"
26
    sys.exit(1)