contrib/release.py: email: don't write '<>' for message-id twice

Minor code refactoring.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2017-10-08 16:39:56 +02:00
parent 832c704443
commit 8c9cd5b7e3
2 changed files with 7 additions and 7 deletions

View File

@ -230,7 +230,7 @@ class User(object):
answer = User.request(msg, prompt).lower()
if answer in ['y', 'yes']:
return True
if defaultToYes and answer not in ['n', 'no']:
if defaultToYes is not False and answer not in ['n', 'no']:
return True
return False

View File

@ -221,7 +221,7 @@ class Announce(object):
self.version = version
def setHeaders(self, messageId, date):
self.fd.write("Message-Id: <{}>\n".format(messageId))
self.fd.write("Message-Id: {}\n".format(messageId))
self.fd.write("Date: {}\n".format(date))
self.fd.write("From: Nicolas Sebrecht <nicolas.s-dev@laposte.net>\n")
self.fd.write("To: {}\n".format(MAILING_LIST))
@ -261,8 +261,8 @@ Pip:
class Website(object):
def updateAPI(self):
req = "update API of the website? (requires {}) [Y/n]".format(SPHINXBUILD)
if not User.yesNo(req, defaultToYes=True):
req = "update API of the website? (requires {})".format(SPHINXBUILD)
if User.yesNo(req, defaultToYes=True) is False:
return False
if check_call(shlex.split("{} --version".format(SPHINXBUILD))) != 0:
@ -451,9 +451,9 @@ if __name__ == '__main__':
websiteBranch = release.getWebsiteBranch()
print(END_MESSAGE.format(
announce=ANNOUNCE_FILE,
new_version=newVersion,
website_branch=websiteBranch)
announce=ANNOUNCE_FILE,
new_version=newVersion,
website_branch=websiteBranch)
)
except Exception as e:
release.restore()