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
|
#!/usr/bin/env python2.4
import os
import re
from subprocess import call
import sys
sys.path.insert(0, '..')
sys.path.insert(0, os.path.dirname(os.path.realpath('/home/abentley/bin/bzr')))
import bzrtools
print "bzrtools version: %s" % bzrtools.__version__
def minigrep(pattern, filename):
setup = open(filename, 'rb')
for line in setup:
match = re.search(pattern, line)
if match is not None:
return match
match = minigrep('version="([^"]*)"', 'setup.py')
if match is None:
print "No version line found"
sys.exit(1)
if match.group(1) != bzrtools.__version__:
print "Mismatch between bzrtools version and setup.py version:\n %s %s"\
% (bzrtools.__version__, match.group(1))
sys.exit(1)
print "setup.py version: %s" % match.group(1)
newsmatch = minigrep('RELEASE: bzrtools %s' % (bzrtools.__version__), 'NEWS')
if newsmatch is None:
print "NEWS entry missing"
sys.exit(1)
else:
print "NEWS entry found"
final_name = '../bzrtools-%s.tar.gz' % bzrtools.__version__
if os.path.exists('../bzrtools.tar.gz'):
print "Temp file exists already."
sys.exit(1)
if os.path.exists(final_name):
print "Final file exists already."
sys.exit(1)
if call(['bzr', 'diff']) != 0:
print "Please commit before releasing"
sys.exit(1)
retcode = call(['bzr', 'export', '../bzrtools.tar.gz'])
if retcode != 0:
sys.exit(1)
os.rename('../bzrtools.tar.gz', final_name)
print 'Created %s' % final_name
call(['gpg', '--detach-sign', final_name])
print 'Uploading...'
call(['scp', final_name, final_name + '.sig',
'panoramicfeedback.com:opensource/'])
|