Reformat offlineimap/contrib/ all files

Add some spaces, remove lines,... now format is better (lintian).
This commit is contained in:
Rodolfo García Peñas (kix) 2020-08-29 20:33:37 +02:00
parent bcc497df16
commit ad53e6f7ab
3 changed files with 43 additions and 48 deletions

View File

@ -8,10 +8,10 @@ Make a new release.
""" """
#TODO: announce: cc list on announce includes all testers # TODO: announce: cc list on announce includes all testers
#TODO: announce: remove empty sections # TODO: announce: remove empty sections
#TODO: websitedoc up # TODO: websitedoc up
#TODO: website branch not including all changes! # TODO: website branch not including all changes!
from os import system, path, rename from os import system, path, rename
@ -25,7 +25,6 @@ from helpers import (
MAILING_LIST, CACHEDIR, EDITOR, Git, OfflineimapInfo, Testers, User, run, goTo MAILING_LIST, CACHEDIR, EDITOR, Git, OfflineimapInfo, Testers, User, run, goTo
) )
__VERSION__ = "0.2" __VERSION__ = "0.2"
SPHINXBUILD = 'sphinx-build' SPHINXBUILD = 'sphinx-build'
@ -140,8 +139,8 @@ class Changelog(object):
def update(self): def update(self):
# Insert excerpt to CHANGELOG. # Insert excerpt to CHANGELOG.
system("sed -i -e '/{}/ r {}' '{}'".format( system("sed -i -e '/{}/ r {}' '{}'".format(
CHANGELOG_MAGIC, CHANGELOG_EXCERPT, CHANGELOG CHANGELOG_MAGIC, CHANGELOG_EXCERPT, CHANGELOG
) )
) )
# Remove trailing whitespaces. # Remove trailing whitespaces.
system("sed -i -r -e 's, +$,,' '{}'".format(CHANGELOG)) system("sed -i -r -e 's, +$,,' '{}'".format(CHANGELOG))
@ -157,7 +156,7 @@ class Changelog(object):
def showPrevious(self): def showPrevious(self):
output = run(shlex.split("cat '{}'".format(CHANGELOG_EXCERPT_OLD))) output = run(shlex.split("cat '{}'".format(CHANGELOG_EXCERPT_OLD)))
for line in output.splitlines(): for line in output.splitlines():
print((line.decode('utf-8'))) # Weird to have to decode bytes here. print((line.decode('utf-8'))) # Weird to have to decode bytes here.
def usePrevious(self): def usePrevious(self):
rename(CHANGELOG_EXCERPT_OLD, CHANGELOG_EXCERPT) rename(CHANGELOG_EXCERPT_OLD, CHANGELOG_EXCERPT)
@ -167,7 +166,7 @@ class Changelog(object):
return self.shouldUsePrevious return self.shouldUsePrevious
def writeExcerpt(self, version, date, def writeExcerpt(self, version, date,
testersList, authorsList, commitsList): testersList, authorsList, commitsList):
with open(CHANGELOG_EXCERPT, 'w+') as fd: with open(CHANGELOG_EXCERPT, 'w+') as fd:
fd.write(CHANGELOG_SKEL.format( fd.write(CHANGELOG_SKEL.format(
@ -188,30 +187,30 @@ class Changelog(object):
if line == "#### Notes": if line == "#### Notes":
currentSection = 'Notes' currentSection = 'Notes'
dict_Content['Notes'] = "" dict_Content['Notes'] = ""
continue # Don't keep this title. continue # Don't keep this title.
elif line == "#### Authors": elif line == "#### Authors":
currentSection = 'Authors' currentSection = 'Authors'
dict_Content['Authors'] = "" dict_Content['Authors'] = ""
continue # Don't keep this title. continue # Don't keep this title.
elif line == "#### Features": elif line == "#### Features":
currentSection = 'Features' currentSection = 'Features'
dict_Content['Features'] = "" dict_Content['Features'] = ""
continue # Don't keep this title. continue # Don't keep this title.
elif line == "#### Fixes": elif line == "#### Fixes":
currentSection = 'Fixes' currentSection = 'Fixes'
dict_Content['Fixes'] = "" dict_Content['Fixes'] = ""
continue # Don't keep this title. continue # Don't keep this title.
elif line == "#### Changes": elif line == "#### Changes":
currentSection = 'Changes' currentSection = 'Changes'
dict_Content['Changes'] = "" dict_Content['Changes'] = ""
continue # Don't keep this title. continue # Don't keep this title.
elif line == "-- ": elif line == "-- ":
break # Stop extraction. break # Stop extraction.
if currentSection is not None: if currentSection is not None:
dict_Content[currentSection] += "{}\n".format(line) dict_Content[currentSection] += "{}\n".format(line)
#TODO: cleanup empty sections. # TODO: cleanup empty sections.
return dict_Content return dict_Content
@ -241,7 +240,7 @@ Pip:
pip install -r ./requirements.txt --user git+https://github.com/OfflineIMAP/offlineimap.git@v{version} pip install -r ./requirements.txt --user git+https://github.com/OfflineIMAP/offlineimap.git@v{version}
""".format(version=self.version) """.format(version=self.version)
) )
def setContent(self, dict_Content): def setContent(self, dict_Content):
self.fd.write("\n") self.fd.write("\n")
@ -262,7 +261,7 @@ Pip:
class Website(object): class Website(object):
def updateUploads(self): def updateUploads(self):
req = ("add new archive to uploads/ on the website? " req = ("add new archive to uploads/ on the website? "
"(warning: checksums will change if it already exists)") "(warning: checksums will change if it already exists)")
if User.yesNo(req, defaultToYes=True) is False: if User.yesNo(req, defaultToYes=True) is False:
return False return False
if check_call(shlex.split("./docs/build-uploads.sh")) != 0: if check_call(shlex.split("./docs/build-uploads.sh")) != 0:
@ -342,7 +341,6 @@ class Release(object):
self.changelog = Changelog() self.changelog = Changelog()
self.websiteBranch = "NO_BRANCH_NAME_ERROR" self.websiteBranch = "NO_BRANCH_NAME_ERROR"
def getVersion(self): def getVersion(self):
return self.offlineimapInfo.getVersion() return self.offlineimapInfo.getVersion()
@ -468,9 +466,9 @@ if __name__ == '__main__':
websiteBranch = release.getWebsiteBranch() websiteBranch = release.getWebsiteBranch()
print((END_MESSAGE.format( print((END_MESSAGE.format(
announce=ANNOUNCE_FILE, announce=ANNOUNCE_FILE,
new_version=newVersion, new_version=newVersion,
website_branch=websiteBranch) website_branch=websiteBranch)
)) ))
except Exception as e: except Exception as e:
release.restore() release.restore()

View File

@ -20,7 +20,6 @@ class App(object):
self.testers = Testers() self.testers = Testers()
self.feedbacks = None self.feedbacks = None
def _getTestersByFeedback(self): def _getTestersByFeedback(self):
if self.feedbacks is not None: if self.feedbacks is not None:
return self.feedbacks return self.feedbacks
@ -43,16 +42,16 @@ class App(object):
parser = argparse.ArgumentParser(description='Manage the feedbacks.') parser = argparse.ArgumentParser(description='Manage the feedbacks.')
parser.add_argument('--add', '-a', dest='add_tester', parser.add_argument('--add', '-a', dest='add_tester',
help='Add tester') help='Add tester')
parser.add_argument('--delete', '-d', dest='delete_tester', parser.add_argument('--delete', '-d', dest='delete_tester',
type=int, type=int,
help='Delete tester NUMBER') help='Delete tester NUMBER')
parser.add_argument('--list', '-l', dest='list_all_testers', parser.add_argument('--list', '-l', dest='list_all_testers',
action='store_true', action='store_true',
help='List the testers') help='List the testers')
parser.add_argument('--switchFeedback', '-s', dest='switch_feedback', parser.add_argument('--switchFeedback', '-s', dest='switch_feedback',
action='store_true', action='store_true',
help='Switch the feedback of a tester') help='Switch the feedback of a tester')
self.args = parser.parse_args() self.args = parser.parse_args()
@ -91,7 +90,6 @@ class App(object):
if ans in ['s']: if ans in ['s']:
self.testers.write() self.testers.write()
def listTesters(self): def listTesters(self):
self._getTestersByFeedback() self._getTestersByFeedback()
@ -101,8 +99,8 @@ class App(object):
if tester.getFeedback() is not True: if tester.getFeedback() is not True:
feedback = "no" feedback = "no"
print(("{:02d} - {} {}: {}".format( print(("{:02d} - {} {}: {}".format(
count, tester.getName(), tester.getEmail(), feedback count, tester.getName(), tester.getEmail(), feedback
) )
)) ))
count += 1 count += 1
@ -132,7 +130,8 @@ class App(object):
self.testers.reset() self.testers.reset()
self.testers.write() self.testers.write()
#def updateMailaliases(self): # def updateMailaliases(self):
if __name__ == '__main__': if __name__ == '__main__':
Git.chdirToRepositoryTopLevel() Git.chdirToRepositoryTopLevel()

View File

@ -14,29 +14,27 @@ from helpers import (
MAILING_LIST, CACHEDIR, EDITOR, Testers, Git, OfflineimapInfo, User MAILING_LIST, CACHEDIR, EDITOR, Testers, Git, OfflineimapInfo, User
) )
UPCOMING_FILE = "{}/upcoming.txt".format(CACHEDIR) UPCOMING_FILE = "{}/upcoming.txt".format(CACHEDIR)
UPCOMING_HEADER = "{}/upcoming-header.txt".format(CACHEDIR) UPCOMING_HEADER = "{}/upcoming-header.txt".format(CACHEDIR)
# Header is like: # Header is like:
# #
#Message-Id: <{messageId}> # Message-Id: <{messageId}>
#Date: {date} # Date: {date}
#From: {name} <{email}> # From: {name} <{email}>
#To: {mailinglist} # To: {mailinglist}
#Cc: {ccList} # Cc: {ccList}
#Subject: [ANNOUNCE] upcoming offlineimap v{expectedVersion} # Subject: [ANNOUNCE] upcoming offlineimap v{expectedVersion}
# #
## Notes ## Notes
# #
#I think it's time for a new release. # 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 # I aim to make the new release in one week, approximately. If you'd like more
#time, please let me know. ,-) # time, please let me know. ,-)
# #
#Please, send me a mail to confirm it works for you. This will be written in the # Please, send me a mail to confirm it works for you. This will be written in the
#release notes and the git logs. # release notes and the git logs.
# #
# #
## Authors ## Authors
@ -57,7 +55,7 @@ if __name__ == '__main__':
ccList.append(email) ccList.append(email)
with open(UPCOMING_FILE, 'w') as upcoming, \ with open(UPCOMING_FILE, 'w') as upcoming, \
open(UPCOMING_HEADER, 'r') as fd_header: open(UPCOMING_HEADER, 'r') as fd_header:
header = {} header = {}
header['messageId'] = Git.buildMessageId() header['messageId'] = Git.buildMessageId()