Explicitly define indicies in formatting statements

Python 2.6 is the latest Python version available on CentOS 6. In Python
2.6, the newer formatting statements must have indexed formatting
specifiers, so you must write

    "{0}{1}".format(foo, bar)

instead of:

    "{}{}".format(foo, bar)

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
This commit is contained in:
Steve Kuznetsov 2017-01-26 14:35:08 -05:00
parent 9f89a7eaa0
commit 5580b02c13
No known key found for this signature in database
GPG key ID: 366E054B30FC03A2
3 changed files with 7 additions and 7 deletions

View file

@ -247,17 +247,17 @@ class BuilderBase(object):
if not self.ran_tgz:
self.tgz()
cmd = 'rpmbuild {}'.format(
cmd = 'rpmbuild {0}'.format(
" ".join([
'--define "_source_filedigest_algorithm md5"',
'--define "_binary_filedigest_algorithm md5"',
self.rpmbuild_options,
self._scl_to_rpmbuild_option(),
self._get_rpmbuild_dir_options(),
"--define 'dist {}'".format(self.dist) if self.dist else "",
"--define 'dist {0}'".format(self.dist) if self.dist else "",
self._get_clean_option(),
self._get_verbosity_option(),
'-ba {}'.format(self.spec_file),
'-ba {0}'.format(self.spec_file),
])
)
try:
@ -468,7 +468,7 @@ class Builder(ConfigObject, BuilderBase):
Can be overridden when custom taggers override counterpart,
tito.VersionTagger._get_tag_for_version().
"""
return "{}-{}".format(self.project_name, version)
return "{0}-{1}".format(self.project_name, version)
def tgz(self):
"""

View file

@ -718,7 +718,7 @@ def munge_setup_macro(fullname, line):
if "%autosetup" in macro:
args_match = re.search(r'(.+?)\s+-p[01]\s+\S+(.*)', args)
if not args_match:
macro = "{} -p1".format(macro)
macro = "{0} -p1".format(macro)
return macro
return None

View file

@ -556,7 +556,7 @@ class VersionTagger(ConfigObject):
suffix = ""
if self.config.has_option(BUILDCONFIG_SECTION, "tag_suffix"):
suffix = self.config.get(BUILDCONFIG_SECTION, "tag_suffix")
return "{}{}".format(version, suffix)
return "{0}{1}".format(version, suffix)
def _get_tag_for_version(self, version):
"""
@ -564,7 +564,7 @@ class VersionTagger(ConfigObject):
Can be overridden when custom taggers override counterpart,
tito.Builder._get_tag_for_version().
"""
return "{}-{}".format(self.project_name, version)
return "{0}-{1}".format(self.project_name, version)
def _update_version_file(self, new_version):
"""