~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to check-release.py

  • Committer: Aaron Bentley
  • Date: 2012-01-20 02:07:15 UTC
  • Revision ID: aaron@aaronbentley.com-20120120020715-ar6jbqnrjcuebggz
Tags: release-2.5
Update for 2.5 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
import os
 
3
import re
 
4
from subprocess import call, PIPE
 
5
import sys
 
6
 
 
7
sys.path.insert(0, '/home/abentley/bzrplugins')
 
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
 
17
 
 
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"
 
24
if call(['bzr', 'diff'], stdout=PIPE) != 0:
 
25
    print "Please commit before releasing"
 
26
    sys.exit(1)