~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to release.py

  • Committer: Max Bowsher
  • Date: 2009-11-13 00:43:08 UTC
  • mto: This revision was merged to the branch mainline in revision 739.
  • Revision ID: maxb@f2s.com-20091113004308-4dcwu1kwt3lhf1kp
Having discovered that bzr-builddeb import_dsc.py is a horrid copy-paste job of bzrtools upstream_import.py, restructure the change to minimize divergence from it.

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
final_name = '../bzrtools-release/bzrtools-%s.tar.gz' % bzrtools.__version__
 
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)
 
31
if call(['bzr', 'diff'], stdout=PIPE) != 0:
 
32
    print "Please commit before releasing"
 
33
    sys.exit(1)
 
34
retcode = call(['bzr', 'tag', 'release-%s' % bzrtools.__version__])
 
35
if retcode != 0:
 
36
    sys.exit(1)
 
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])
 
43
#print 'Uploading...'
 
44
#call(['scp', final_name, final_name + '.sig',
 
45
#      'panoramicfeedback.com:opensource/'])