[Python-checkins] r66519 - sandbox/trunk/release/release.py
benjamin.peterson
python-checkins at python.org
Sat Sep 20 00:45:47 CEST 2008
Author: benjamin.peterson
Date: Sat Sep 20 00:45:46 2008
New Revision: 66519
Log:
build and tarball the docs during --export
Modified:
sandbox/trunk/release/release.py
Modified: sandbox/trunk/release/release.py
==============================================================================
--- sandbox/trunk/release/release.py (original)
+++ sandbox/trunk/release/release.py Sat Sep 20 00:45:46 2008
@@ -64,7 +64,7 @@
help='bump the revision number in important files')
p.add_option('-e', '--export',
default=False, action='store_true',
- help='Export the SVN tag to a tarball')
+ help='Export the SVN tag to a tarball and build docs')
p.add_option('-m', '--branch',
default=False, action='store_true',
help='create a maintance branch to go along with the release')
@@ -198,20 +198,52 @@
finally:
os.chdir(old)
+def make_dist():
+ try:
+ os.mkdir('dist')
+ except OSError:
+ if not os.path.isdir('dist'):
+ error('dist/ is not a directory')
+ else:
+ print 'created dist directory'
+
+def tarball(source):
+ """Build tarballs for a directory."""
+ print 'Making .tgz'
+ tgz = source + '.tgz'
+ bz = source + '.tar.bz2'
+ run_cmd(['tar cf - %s | gzip -9 > %s' % (source, tgz)])
+ print "Making .tar.bz2"
+ run_cmd(['tar cf - %s | bzip2 -9 > %s' %
+ (source, bz)])
+ print 'Calculating md5 sums'
+ md5sum_tgz = md5()
+ with open(tgz, 'rb') as data:
+ md5sum_tgz.update(data.read())
+ md5sum_bz2 = md5()
+ with open(bz, 'rb') as data:
+ md5sum_bz2.update(data.read())
+ print ' %s %8s %s' % (
+ md5sum_tgz.hexdigest(), int(os.path.getsize(tgz)), tgz)
+ print ' %s %8s %s' % (
+ md5sum_bz2.hexdigest(), int(os.path.getsize(bz)), bz)
+ with open(tgz + '.md5', 'w') as md5file:
+ print >> md5file, md5sum_tgz.hexdigest()
+ with open(bz + '.md5', 'w') as md5file:
+ print >> md5file, md5sum_bz2.hexdigest()
+
+ print 'Signing tarballs'
+ os.system('gpg -bas ' + tgz)
+ os.system('gpg -bas ' + bz)
+
def export(tag):
- if not os.path.exists('dist'):
- print 'creating dist directory'
- os.mkdir('dist')
- if not os.path.isdir('dist'):
- error('dist/ is not a directory')
- tgz = 'dist/Python-%s.tgz' % tag.text
- bz = 'dist/Python-%s.tar.bz2' % tag.text
+ make_dist()
old_cur = os.getcwd()
with changed_dir('dist'):
print 'Exporting tag:', tag.text
python = 'Python-%s' % tag.text
- run_cmd(['svn', 'export',
+ run_cmd(['svn', 'export', '-q',
'http://svn.python.org/projects/python/tags/r%s'
% tag.nickname, python])
with changed_dir(python):
@@ -223,34 +255,25 @@
print 'Touching Python-ast.h and Python-ast.c'
for name in ('Include/Python-ast.h', 'Python/Python-ast.c'):
os.utime(name, None)
- print 'Making .tgz'
- run_cmd(['tar cf - %s | gzip -9 > %s.tgz' % (python, python)])
- print "Making .tar.bz2"
- run_cmd(['tar cf - %s | bzip2 -9 > %s.tar.bz2' %
- (python, python)])
- print 'Calculating md5 sums'
- md5sum_tgz = md5()
- with open(tgz) as source:
- md5sum_tgz.update(source.read())
- md5sum_bz2 = md5()
- with open(bz) as source:
- md5sum_bz2.update(source.read())
- print ' %s %8s %s' % (
- md5sum_tgz.hexdigest(), int(os.path.getsize(tgz)), tgz)
- print ' %s %8s %s' % (
- md5sum_bz2.hexdigest(), int(os.path.getsize(bz)), bz)
- with open(tgz + '.md5', 'w') as md5file:
- print >> md5file, md5sum_tgz.hexdigest()
- with open(bz + '.md5', 'w') as md5file:
- print >> md5file, md5sum_bz2.hexdigest()
- print 'Signing tarballs'
- os.system('gpg -bas ' + tgz)
- os.system('gpg -bas ' + bz)
+ docs = build_docs()
+ exported_docs = 'Python-%s-docs-html' % tag.text
+ shutil.copytree(docs, exported_docs)
+
+ tarball(python)
+ tarball(exported_docs)
print '\n**Now extract the archives and run the tests**'
print '**You may also want to run make install and re-test**'
+def build_docs():
+ """Build and tarball the documentation"""
+ print "Building docs"
+ with changed_dir('Doc'):
+ run_cmd(['make', 'html'])
+ return os.path.abspath('build/html')
+
+
class Tag(object):
def __init__(self, tag_name):
More information about the Python-checkins
mailing list