Restore compatibility with python 3.5

This commit is contained in:
Benjamin Renard 2022-11-24 11:09:41 +01:00
parent 9c9773f489
commit 0c3ddea197
2 changed files with 11 additions and 7 deletions

View file

@ -4,3 +4,4 @@ disable=invalid-name,
too-many-arguments, too-many-arguments,
too-many-branches, too-many-branches,
line-too-long, line-too-long,
consider-using-f-string, # to keep compatibility with python 3.5

17
gitdch
View file

@ -15,7 +15,9 @@ DEFAULT_GIT_PATCH = './'
DEFAULT_CODE_NAME = 'unstable' DEFAULT_CODE_NAME = 'unstable'
DEFAULT_URGENCY = 'medium' DEFAULT_URGENCY = 'medium'
parser = argparse.ArgumentParser(description=f'{__doc__} (version: {VERSION})') parser = argparse.ArgumentParser(
description='{0} (version: {1})'.format(__doc__, VERSION)
)
parser.add_argument( parser.add_argument(
'-d', '--debug', '-d', '--debug',
@ -55,7 +57,7 @@ parser.add_argument(
'--path', '--path',
type=str, type=str,
dest='git_path', dest='git_path',
help=f'Git repository path (default: {DEFAULT_GIT_PATCH}', help='Git repository path (default: %s)' % DEFAULT_GIT_PATCH,
default=DEFAULT_GIT_PATCH default=DEFAULT_GIT_PATCH
) )
@ -97,7 +99,7 @@ parser.add_argument(
'--code-name', '--code-name',
type=str, type=str,
dest='code_name', dest='code_name',
help=f'Debian code name (default: {DEFAULT_CODE_NAME})', help='Debian code name (default: %s)' % DEFAULT_CODE_NAME,
default=DEFAULT_CODE_NAME default=DEFAULT_CODE_NAME
) )
@ -106,7 +108,7 @@ parser.add_argument(
'--urgency', '--urgency',
type=str, type=str,
dest='urgency', dest='urgency',
help=f'Package urgency (default: {DEFAULT_URGENCY})', help='Package urgency (default: %s)' % DEFAULT_URGENCY,
default=DEFAULT_URGENCY default=DEFAULT_URGENCY
) )
@ -144,8 +146,9 @@ if not options.package_name:
# Initialize log # Initialize log
log = logging.getLogger() log = logging.getLogger()
logformat = logging.Formatter( logformat = logging.Formatter(
f'%(asctime)s - {os.path.basename(sys.argv[0])} - %(levelname)s ' '%(asctime)s - {} - %(levelname)s : %(message)s'.format(
': %(message)s' os.path.basename(sys.argv[0])
)
) )
# Set root logger to DEBUG (filtering done by handlers) # Set root logger to DEBUG (filtering done by handlers)
log.setLevel(logging.DEBUG) log.setLevel(logging.DEBUG)
@ -272,7 +275,7 @@ if options.release_notes:
log.info('Generate Markdown release notes') log.info('Generate Markdown release notes')
release_notes_lines = ['# Changelog:\n\n'] release_notes_lines = ['# Changelog:\n\n']
release_notes_lines.extend([ release_notes_lines.extend([
f'* {message}\n' '* {0}\n'.format(message)
for message in versions[0]['messages'] for message in versions[0]['messages']
]) ])
log.info( log.info(