docker-offlineimap/contrib/upcoming.py

75 lines
1.8 KiB
Python
Raw Normal View History

#!/usr/bin/python3
"""
Put into Public Domain, by Nicolas Sebrecht.
Produce the "upcoming release" notes.
"""
from os import system
from helpers import (
MAILING_LIST, CACHEDIR, EDITOR, Testers, Git, OfflineimapInfo, User
)
UPCOMING_FILE = "{}/upcoming.txt".format(CACHEDIR)
UPCOMING_HEADER = """
Message-Id: <{messageId}>
Date: {date}
From: {name} <{email}>
To: {mailinglist}
Cc: {ccList}
Subject: [ANNOUNCE] upcoming offlineimap v{expectedVersion}
# Notes
I think it's time for a new release.
I aim to make the new release in one week, approximately. If you'd like more
time, please let me know. ,-)
Please, send me a mail to confirm it works for you. This will be written in the
release notes and the git logs.
# Authors
"""
if __name__ == '__main__':
offlineimapInfo = OfflineimapInfo()
Git.chdirToRepositoryTopLevel()
oVersion = offlineimapInfo.getVersion()
ccList = Testers.listTestersInTeam()
authors = Git.getAuthorsList(oVersion)
for author in authors:
email = author.getEmail()
if email not in ccList:
ccList.append(email)
with open(UPCOMING_FILE, 'w') as upcoming:
header = {}
header['messageId'] = Git.buildMessageId()
header['date'] = Git.buildDate()
header['name'], header['email'] = Git.getLocalUser()
header['mailinglist'] = MAILING_LIST
header['expectedVersion'] = User.request("Expected new version?")
header['ccList'] = ", ".join(ccList)
upcoming.write(UPCOMING_HEADER.format(**header).lstrip())
upcoming.write(Git.getShortlog(oVersion))
upcoming.write("\n\n# Diffstat\n\n")
upcoming.write(Git.getDiffstat(oVersion))
upcoming.write("\n\n\n-- \n{}\n".format(Git.getLocalUser()[0]))
system("{} {}".format(EDITOR, UPCOMING_FILE))