lp-project-upload: Invoke editor to specify changelog and release notes,

and add those to the project release.
This commit is contained in:
Martin Pitt 2009-11-20 16:59:00 -06:00
parent 471fb39dbe
commit 982cd8bbfd
2 changed files with 27 additions and 1 deletions

2
debian/changelog vendored
View File

@ -22,6 +22,8 @@ ubuntu-dev-tools (0.83) UNRELEASED; urgency=low
[ Martin Pitt ]
* lp-project-upload: Generate tarball signature if it is not present yet.
* lp-project-upload: Invoke editor to specify changelog and release notes,
and add those to the project release.
-- Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com> Tue, 17 Nov 2009 19:44:44 +0100

View File

@ -18,7 +18,7 @@
'''Upload a release tarball to a Launchpad project.'''
import sys, datetime, os.path, subprocess
import sys, datetime, os.path, subprocess, tempfile, os
from ubuntutools.lp.libsupport import get_launchpad
from launchpadlib.errors import HTTPError
@ -39,6 +39,20 @@ def create_release(project, version):
date_targeted=release_date)
return milestone.createProductRelease(date_released=release_date)
def edit_file(prefix, description):
(fd, f) = tempfile.mkstemp(prefix=prefix+'.')
os.write(fd, '\n\n#------\n# Please enter the %s here. Lines which start with "#" are ignored.\n' %
description)
os.close(fd)
subprocess.call(['sensible-editor', f])
content = ''
for l in open(f):
if l.startswith('#'):
continue
content += l
return content.strip()
#
# main
#
@ -88,6 +102,16 @@ try:
file_content=file_content, content_type='appplication/x-gzip',
file_type='Code Release Tarball', signature_filename=signature,
signature_content=signature_content)
changelog = edit_file('changelog', 'changelog')
if changelog:
release.changelog = changelog
release_notes = edit_file('releasenotes', 'release notes')
if release_notes:
release.release_notes = release_notes
release.lp_save()
except HTTPError, e:
print 'An error happened in the upload:', e.content
sys.exit(1)