From ad53e6f7aba3a0383b0db83731a08e4c9331ad9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sat, 29 Aug 2020 20:33:37 +0200 Subject: [PATCH] Reformat offlineimap/contrib/ all files Add some spaces, remove lines,... now format is better (lintian). --- contrib/release.py | 42 ++++++++++++++++++++---------------------- contrib/tested-by.py | 23 +++++++++++------------ contrib/upcoming.py | 26 ++++++++++++-------------- 3 files changed, 43 insertions(+), 48 deletions(-) diff --git a/contrib/release.py b/contrib/release.py index 257477f..81d9873 100755 --- a/contrib/release.py +++ b/contrib/release.py @@ -8,10 +8,10 @@ Make a new release. """ -#TODO: announce: cc list on announce includes all testers -#TODO: announce: remove empty sections -#TODO: websitedoc up -#TODO: website branch not including all changes! +# TODO: announce: cc list on announce includes all testers +# TODO: announce: remove empty sections +# TODO: websitedoc up +# TODO: website branch not including all changes! from os import system, path, rename @@ -25,7 +25,6 @@ from helpers import ( MAILING_LIST, CACHEDIR, EDITOR, Git, OfflineimapInfo, Testers, User, run, goTo ) - __VERSION__ = "0.2" SPHINXBUILD = 'sphinx-build' @@ -140,8 +139,8 @@ class Changelog(object): def update(self): # Insert excerpt to CHANGELOG. system("sed -i -e '/{}/ r {}' '{}'".format( - CHANGELOG_MAGIC, CHANGELOG_EXCERPT, CHANGELOG - ) + CHANGELOG_MAGIC, CHANGELOG_EXCERPT, CHANGELOG + ) ) # Remove trailing whitespaces. system("sed -i -r -e 's, +$,,' '{}'".format(CHANGELOG)) @@ -157,7 +156,7 @@ class Changelog(object): def showPrevious(self): output = run(shlex.split("cat '{}'".format(CHANGELOG_EXCERPT_OLD))) 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): rename(CHANGELOG_EXCERPT_OLD, CHANGELOG_EXCERPT) @@ -167,7 +166,7 @@ class Changelog(object): return self.shouldUsePrevious def writeExcerpt(self, version, date, - testersList, authorsList, commitsList): + testersList, authorsList, commitsList): with open(CHANGELOG_EXCERPT, 'w+') as fd: fd.write(CHANGELOG_SKEL.format( @@ -188,30 +187,30 @@ class Changelog(object): if line == "#### Notes": currentSection = 'Notes' dict_Content['Notes'] = "" - continue # Don't keep this title. + continue # Don't keep this title. elif line == "#### Authors": currentSection = 'Authors' dict_Content['Authors'] = "" - continue # Don't keep this title. + continue # Don't keep this title. elif line == "#### Features": currentSection = 'Features' dict_Content['Features'] = "" - continue # Don't keep this title. + continue # Don't keep this title. elif line == "#### Fixes": currentSection = 'Fixes' dict_Content['Fixes'] = "" - continue # Don't keep this title. + continue # Don't keep this title. elif line == "#### Changes": currentSection = 'Changes' dict_Content['Changes'] = "" - continue # Don't keep this title. + continue # Don't keep this title. elif line == "-- ": - break # Stop extraction. + break # Stop extraction. if currentSection is not None: dict_Content[currentSection] += "{}\n".format(line) - #TODO: cleanup empty sections. + # TODO: cleanup empty sections. return dict_Content @@ -241,7 +240,7 @@ Pip: pip install -r ./requirements.txt --user git+https://github.com/OfflineIMAP/offlineimap.git@v{version} """.format(version=self.version) - ) + ) def setContent(self, dict_Content): self.fd.write("\n") @@ -262,7 +261,7 @@ Pip: class Website(object): def updateUploads(self): 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: return False if check_call(shlex.split("./docs/build-uploads.sh")) != 0: @@ -342,7 +341,6 @@ class Release(object): self.changelog = Changelog() self.websiteBranch = "NO_BRANCH_NAME_ERROR" - def getVersion(self): return self.offlineimapInfo.getVersion() @@ -468,9 +466,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() diff --git a/contrib/tested-by.py b/contrib/tested-by.py index 32ff7a9..c37f3dd 100755 --- a/contrib/tested-by.py +++ b/contrib/tested-by.py @@ -20,7 +20,6 @@ class App(object): self.testers = Testers() self.feedbacks = None - def _getTestersByFeedback(self): if self.feedbacks is not None: return self.feedbacks @@ -43,16 +42,16 @@ class App(object): parser = argparse.ArgumentParser(description='Manage the feedbacks.') parser.add_argument('--add', '-a', dest='add_tester', - help='Add tester') + help='Add tester') parser.add_argument('--delete', '-d', dest='delete_tester', - type=int, - help='Delete tester NUMBER') + type=int, + help='Delete tester NUMBER') parser.add_argument('--list', '-l', dest='list_all_testers', - action='store_true', - help='List the testers') + action='store_true', + help='List the testers') parser.add_argument('--switchFeedback', '-s', dest='switch_feedback', - action='store_true', - help='Switch the feedback of a tester') + action='store_true', + help='Switch the feedback of a tester') self.args = parser.parse_args() @@ -91,7 +90,6 @@ class App(object): if ans in ['s']: self.testers.write() - def listTesters(self): self._getTestersByFeedback() @@ -101,8 +99,8 @@ class App(object): if tester.getFeedback() is not True: feedback = "no" print(("{:02d} - {} {}: {}".format( - count, tester.getName(), tester.getEmail(), feedback - ) + count, tester.getName(), tester.getEmail(), feedback + ) )) count += 1 @@ -132,7 +130,8 @@ class App(object): self.testers.reset() self.testers.write() - #def updateMailaliases(self): + # def updateMailaliases(self): + if __name__ == '__main__': Git.chdirToRepositoryTopLevel() diff --git a/contrib/upcoming.py b/contrib/upcoming.py index 461dd47..bc04c76 100755 --- a/contrib/upcoming.py +++ b/contrib/upcoming.py @@ -14,29 +14,27 @@ from helpers import ( MAILING_LIST, CACHEDIR, EDITOR, Testers, Git, OfflineimapInfo, User ) - - UPCOMING_FILE = "{}/upcoming.txt".format(CACHEDIR) UPCOMING_HEADER = "{}/upcoming-header.txt".format(CACHEDIR) # Header is like: # -#Message-Id: <{messageId}> -#Date: {date} -#From: {name} <{email}> -#To: {mailinglist} -#Cc: {ccList} -#Subject: [ANNOUNCE] upcoming offlineimap v{expectedVersion} +# 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 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. ,-) +# 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. +# Please, send me a mail to confirm it works for you. This will be written in the +# release notes and the git logs. # # ## Authors @@ -57,7 +55,7 @@ if __name__ == '__main__': ccList.append(email) with open(UPCOMING_FILE, 'w') as upcoming, \ - open(UPCOMING_HEADER, 'r') as fd_header: + open(UPCOMING_HEADER, 'r') as fd_header: header = {} header['messageId'] = Git.buildMessageId()