summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGökçen Nurlu <gnurlu1@bloomberg.net>2017-11-13 10:22:12 +0000
committerGökçen Nurlu <gnurlu1@bloomberg.net>2017-11-17 11:46:34 +0000
commit3b17762a4cab23c238762ca32baa348788347473 (patch)
tree3f709fac5b116154c8535abd44f878ba96a8eab0
parent44b00de090348f94d27998e5378c1beef0db6296 (diff)
downloadbuildstream-3b17762a4cab23c238762ca32baa348788347473.tar.gz
Switch old-style string formattings to new '.format()'
-rw-r--r--buildstream/_artifactcache/pushreceive.py28
-rw-r--r--buildstream/_frontend/main.py8
-rw-r--r--buildstream/_fuse/fuse.py6
-rw-r--r--buildstream/_loader.py18
-rw-r--r--buildstream/_options/optionpool.py2
-rw-r--r--buildstream/_ostree.py3
-rw-r--r--buildstream/_variables.py2
-rw-r--r--buildstream/_yaml.py34
-rw-r--r--buildstream/buildelement.py4
-rw-r--r--buildstream/plugins/sources/git.py16
-rw-r--r--buildstream/plugins/sources/local.py2
-rw-r--r--buildstream/plugins/sources/patch.py4
-rw-r--r--buildstream/source.py10
-rw-r--r--buildstream/utils.py16
-rw-r--r--tests/project/data/plugins/elements/custom.py2
-rw-r--r--tests/project/data/plugins/sources/custom.py2
-rw-r--r--tests/variables/variables.py4
17 files changed, 81 insertions, 80 deletions
diff --git a/buildstream/_artifactcache/pushreceive.py b/buildstream/_artifactcache/pushreceive.py
index 8d2d3fb0b..9aef842a8 100644
--- a/buildstream/_artifactcache/pushreceive.py
+++ b/buildstream/_artifactcache/pushreceive.py
@@ -67,8 +67,8 @@ def msg_byteorder(sys_byteorder=sys.byteorder):
elif sys_byteorder == 'big':
return 'B'
else:
- raise PushException('Unrecognized system byteorder %s'
- % sys_byteorder)
+ raise PushException('Unrecognized system byteorder {}'
+ .format(sys_byteorder))
def sys_byteorder(msg_byteorder):
@@ -77,8 +77,8 @@ def sys_byteorder(msg_byteorder):
elif msg_byteorder == 'B':
return 'big'
else:
- raise PushException('Unrecognized message byteorder %s'
- % msg_byteorder)
+ raise PushException('Unrecognized message byteorder {}'
+ .format(msg_byteorder))
def ostree_object_path(repo, obj):
@@ -220,18 +220,18 @@ class PushMessageReader(object):
def decode_header(self, header):
if len(header) != HEADER_SIZE:
- raise Exception('Header is %d bytes, not %d' % (len(header), HEADER_SIZE))
+ raise Exception('Header is {:d} bytes, not {:d}'.format(len(header), HEADER_SIZE))
order = sys_byteorder(chr(header[0]))
version = int(header[1])
if version != PROTO_VERSION:
- raise Exception('Unsupported protocol version %d' % version)
+ raise Exception('Unsupported protocol version {:d}'.format(version))
cmdtype = PushCommandType(int(header[2]))
vlen = int.from_bytes(header[3:], order)
return order, version, cmdtype, vlen
def decode_message(self, message, size, order):
if len(message) != size:
- raise Exception('Expected %d bytes, but got %d' % (size, len(message)))
+ raise Exception('Expected {:d} bytes, but got {:d}'.format(size, len(message)))
data = GLib.Bytes.new(message)
variant = GLib.Variant.new_from_bytes(GLib.VariantType.new('a{sv}'),
data, False)
@@ -317,7 +317,7 @@ def parse_remote_location(remotepath, remote_port):
if url.netloc:
if url.scheme != 'ssh':
raise PushException('Only URL scheme ssh is allowed, '
- 'not "%s"' % url.scheme)
+ 'not "{}"'.format(url.scheme))
remote_host = url.hostname
remote_user = url.username
remote_repo = url.path
@@ -333,9 +333,9 @@ def parse_remote_location(remotepath, remote_port):
remainder = parts[0]
parts = remainder.split(':', 1)
if len(parts) != 2:
- raise PushException('Remote repository "%s" does not '
+ raise PushException('Remote repository "{}" does not '
'contain a hostname and path separated '
- 'by ":"' % remotepath)
+ 'by ":"'.format(remotepath))
remote_host, remote_repo = parts
return remote_host, remote_user, remote_repo, remote_port
@@ -407,15 +407,15 @@ class OSTreePusher(object):
_, commit = self.repo.load_variant_if_exists(OSTree.ObjectType.COMMIT,
parent)
if commit is None:
- raise PushException('Shallow history from commit %s does '
- 'not contain remote commit %s' % (local, remote))
+ raise PushException('Shallow history from commit {} does '
+ 'not contain remote commit {}'.format(local, remote))
parent = OSTree.commit_get_parent(commit)
if parent is None:
break
if remote is not None and parent != remote:
self.writer.send_done()
- raise PushExistsException('Remote commit %s not descendent of '
- 'commit %s' % (remote, local))
+ raise PushExistsException('Remote commit {} not descendent of '
+ 'commit {}'.format(remote, local))
def needed_objects(self, commits):
objects = set()
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py
index 4e00a2be1..46cc7a9ca 100644
--- a/buildstream/_frontend/main.py
+++ b/buildstream/_frontend/main.py
@@ -497,7 +497,7 @@ def shell(app, element, sysroot, build, command):
sys.exit(exitcode)
except BstError as e:
click.echo("")
- click.echo("Errors shelling into this pipeline: %s" % str(e))
+ click.echo("Errors shelling into this pipeline: {}".format(str(e)))
sys.exit(-1)
@@ -773,7 +773,7 @@ class App():
self.context = Context(self.main_options['option'])
self.context.load(config)
except BstError as e:
- click.echo("Error loading user configuration: %s" % str(e))
+ click.echo("Error loading user configuration: {}".format(str(e)))
sys.exit(-1)
# Override things in the context from our command line options,
@@ -831,7 +831,7 @@ class App():
try:
self.project = Project(directory, self.context)
except BstError as e:
- click.echo("Error loading project: %s" % str(e))
+ click.echo("Error loading project: {}".format(str(e)))
sys.exit(-1)
try:
@@ -844,7 +844,7 @@ class App():
remote_ticker=self.remote_ticker,
cache_ticker=self.cache_ticker)
except BstError as e:
- click.echo("Error loading pipeline: %s" % str(e))
+ click.echo("Error loading pipeline: {}".format(str(e)))
sys.exit(-1)
# Create our status printer, only available in interactive
diff --git a/buildstream/_fuse/fuse.py b/buildstream/_fuse/fuse.py
index f0ad96fba..89173ba11 100644
--- a/buildstream/_fuse/fuse.py
+++ b/buildstream/_fuse/fuse.py
@@ -268,7 +268,7 @@ elif _system == 'Linux':
('st_ctimespec', c_timespec),
('st_ino', c_ulonglong)]
else:
- raise NotImplementedError('%s is not supported.' % _system)
+ raise NotImplementedError('{} is not supported.'.format(_system))
class c_statvfs(Structure):
@@ -507,7 +507,7 @@ class FUSE(object):
if isinstance(value, bool):
if value is True: yield key
else:
- yield '%s=%s' % (key, value)
+ yield '{}={}'.format(key, value)
@staticmethod
def _wrapper(func, *args, **kwargs):
@@ -608,7 +608,7 @@ class FUSE(object):
retsize = len(ret)
assert retsize <= size, \
- 'actual amount read %d greater than expected %d' % (retsize, size)
+ 'actual amount read {:d} greater than expected {:d}'.format(retsize, size)
data = create_string_buffer(ret, retsize)
memmove(buf, data, retsize)
diff --git a/buildstream/_loader.py b/buildstream/_loader.py
index 9a3fd5eaa..f086625d5 100644
--- a/buildstream/_loader.py
+++ b/buildstream/_loader.py
@@ -154,8 +154,8 @@ def extract_depends_from_node(owner, data):
elif dep_type not in [Symbol.BUILD, Symbol.RUNTIME]:
provenance = _yaml.node_get_provenance(dep, key=Symbol.TYPE)
raise LoadError(LoadErrorReason.INVALID_DATA,
- "%s: Dependency type '%s' is not 'build', 'runtime' or 'all'" %
- (str(provenance), dep_type))
+ "{}: Dependency type '{}' is not 'build', 'runtime' or 'all'"
+ .format(str(provenance), dep_type))
filename = _yaml.node_get(dep, str, Symbol.FILENAME)
dependency = Dependency(owner, filename, filename=filename,
@@ -166,8 +166,8 @@ def extract_depends_from_node(owner, data):
provenance = _yaml.node_get_provenance(data, key=Symbol.DEPENDS, indices=[index])
raise LoadError(LoadErrorReason.INVALID_DATA,
- "%s: List '%s' element %d is not a list or dict" %
- (str(provenance), Symbol.DEPENDS, index))
+ "{}: List '{}' element {:d} is not a list or dict"
+ .format(str(provenance), Symbol.DEPENDS, index))
output_deps.append(dependency)
@@ -198,9 +198,9 @@ class Loader():
# XXX Should this just be an assertion ?
# Expect that the caller gives us the right thing at least ?
raise LoadError(LoadErrorReason.INVALID_DATA,
- "Target '%s' was not specified as a relative "
- "path to the base project directory: %s" %
- (filename, basedir))
+ "Target '{}' was not specified as a relative "
+ "path to the base project directory: {}"
+ .format(filename, basedir))
self.options = options # Project options (OptionPool)
self.basedir = basedir # Base project directory
@@ -314,8 +314,8 @@ class Loader():
if check_elements.get(element_name) is not None:
raise LoadError(LoadErrorReason.CIRCULAR_DEPENDENCY,
- "Circular dependency detected for element: %s" %
- element.filename)
+ "Circular dependency detected for element: {}"
+ .format(element.filename))
# Push / Check each dependency / Pop
check_elements[element_name] = True
diff --git a/buildstream/_options/optionpool.py b/buildstream/_options/optionpool.py
index 387080110..90a404bfb 100644
--- a/buildstream/_options/optionpool.py
+++ b/buildstream/_options/optionpool.py
@@ -138,7 +138,7 @@ class OptionPool():
# Variables must be resolved at this point.
#
try:
- template_string = "{%% if %s %%} True {%% else %%} False {%% endif %%}" % expression
+ template_string = "{{% if {} %}} True {{% else %}} False {{% endif %}}".format(expression)
template = self.environment.from_string(template_string)
context = template.new_context(self.variables, shared=True)
result = template.root_render_func(context)
diff --git a/buildstream/_ostree.py b/buildstream/_ostree.py
index 794c57df3..736269169 100644
--- a/buildstream/_ostree.py
+++ b/buildstream/_ostree.py
@@ -271,7 +271,8 @@ def fetch(repo, remote="origin", ref=None, progress=None):
else:
percent = (fetched * 1.0 / requested) * 100
- progress(percent, "Receiving objects: %d%% (%d/%d) %s" % (percent, fetched, requested, formatted_bytes))
+ progress(percent,
+ "Receiving objects: {:d}% ({:d}/{:d}) {}".format(percent, fetched, requested, formatted_bytes))
else:
progress(100.0, "Writing Objects")
diff --git a/buildstream/_variables.py b/buildstream/_variables.py
index 15e5ecac1..fa73006e6 100644
--- a/buildstream/_variables.py
+++ b/buildstream/_variables.py
@@ -159,7 +159,7 @@ class Variables():
summary += line.format(unmatched=unmatch, variable=var, provenance=provenance)
raise LoadError(LoadErrorReason.UNRESOLVED_VARIABLE,
- "Failed to resolve one or more variable:\n%s" % summary)
+ "Failed to resolve one or more variable:\n{}".format(summary))
last_unmatched = unmatched
diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py
index b4693b836..eb6719360 100644
--- a/buildstream/_yaml.py
+++ b/buildstream/_yaml.py
@@ -53,7 +53,7 @@ class Provenance():
# Convert a Provenance to a string for error reporting
def __str__(self):
- return "%s [line %d column %d]" % (self.filename, self.line, self.col)
+ return "{} [line {:d} column {:d}]".format(self.filename, self.line, self.col)
# Abstract method
def clone(self):
@@ -152,9 +152,9 @@ class CompositeTypeError(CompositeError):
def __init__(self, path, expected_type, actual_type):
super(CompositeTypeError, self).__init__(
path,
- "Error compositing dictionary key '%s', expected source type '%s' "
- "but received type '%s'" %
- (path, expected_type.__name__, actual_type.__name__))
+ "Error compositing dictionary key '{}', expected source type '{}' "
+ "but received type '{}'"
+ .format(path, expected_type.__name__, actual_type.__name__))
self.expected_type = expected_type
self.actual_type = actual_type
@@ -180,7 +180,7 @@ def load(filename, shortname=None, copy_tree=False):
return load_data(f, shortname=shortname, copy_tree=copy_tree)
except FileNotFoundError as e:
raise LoadError(LoadErrorReason.MISSING_FILE,
- "Could not find file at %s" % filename) from e
+ "Could not find file at {}".format(filename)) from e
# Like load(), but doesnt require the data to be in a file
@@ -191,7 +191,7 @@ def load_data(data, shortname=None, copy_tree=False):
contents = yaml.load(data, yaml.loader.RoundTripLoader)
except (yaml.scanner.ScannerError, yaml.composer.ComposerError, yaml.parser.ParserError) as e:
raise LoadError(LoadErrorReason.INVALID_YAML,
- "Malformed YAML:\n\n%s\n\n%s\n" % (e.problem, e.problem_mark)) from e
+ "Malformed YAML:\n\n{}\n\n{}\n".format(e.problem, e.problem_mark)) from e
if not isinstance(contents, dict):
# Special case allowance for None, when the loaded file has only comments in it.
@@ -199,8 +199,8 @@ def load_data(data, shortname=None, copy_tree=False):
contents = {}
else:
raise LoadError(LoadErrorReason.INVALID_YAML,
- "YAML file has content of type '%s' instead of expected type 'dict': %s" %
- (type(contents).__name__, shortname))
+ "YAML file has content of type '{}' instead of expected type 'dict': {}"
+ .format(type(contents).__name__, shortname))
return node_decorated_copy(shortname, contents, copy_tree=copy_tree)
@@ -326,7 +326,7 @@ def node_get(node, expected_type, key, indices=[], default_value=None):
provenance = node_get_provenance(node)
if value is None:
raise LoadError(LoadErrorReason.INVALID_DATA,
- "%s: Dictionary did not contain expected key '%s'" % (str(provenance), key))
+ "{}: Dictionary did not contain expected key '{}'".format(str(provenance), key))
path = key
if indices:
@@ -334,7 +334,7 @@ def node_get(node, expected_type, key, indices=[], default_value=None):
value = node_get(node, list, key)
for index in indices:
value = value[index]
- path += '[%d]' % index
+ path += '[{:d}]'.format(index)
if not isinstance(value, expected_type):
# Attempt basic conversions if possible, typically we want to
@@ -359,8 +359,8 @@ def node_get(node, expected_type, key, indices=[], default_value=None):
except (ValueError, TypeError):
provenance = node_get_provenance(node, key=key, indices=indices)
raise LoadError(LoadErrorReason.INVALID_DATA,
- "%s: Value of '%s' is not of the expected type '%s'" %
- (str(provenance), path, expected_type.__name__))
+ "{}: Value of '{}' is not of the expected type '{}'"
+ .format(str(provenance), path, expected_type.__name__))
# Trim it at the bud, let all loaded strings from yaml be stripped of whitespace
if isinstance(value, str):
@@ -757,11 +757,11 @@ def composite(target, source):
if source_provenance:
error_prefix = "{}: ".format(str(source_provenance))
raise LoadError(LoadErrorReason.ILLEGAL_COMPOSITE,
- "%sExpected '%s' type for configuration '%s', instead received '%s'" %
- (error_prefix,
- e.expected_type.__name__,
- e.path,
- e.actual_type.__name__)) from e
+ "{}Expected '{}' type for configuration '{}', instead received '{}'"
+ .format(error_prefix,
+ e.expected_type.__name__,
+ e.path,
+ e.actual_type.__name__)) from e
# SanitizedDict is an OrderedDict that is dumped as unordered mapping.
diff --git a/buildstream/buildelement.py b/buildstream/buildelement.py
index a794e9844..0870c83ad 100644
--- a/buildstream/buildelement.py
+++ b/buildstream/buildelement.py
@@ -184,9 +184,9 @@ class BuildElement(Element):
if not commands:
continue
- with self.timed_activity("Running %s" % command_name):
+ with self.timed_activity("Running {}".format(command_name)):
for cmd in commands:
- self.status("Running %s" % command_name, detail=cmd)
+ self.status("Running {}".format(command_name), detail=cmd)
# Note the -e switch to 'sh' means to exit with an error
# if any untested command fails.
diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py
index d7a87c86c..4aca57ffb 100644
--- a/buildstream/plugins/sources/git.py
+++ b/buildstream/plugins/sources/git.py
@@ -104,8 +104,8 @@ class GitMirror():
try:
shutil.move(tmpdir, self.mirror)
except (shutil.Error, OSError) as e:
- raise SourceError("%s: Failed to move cloned git repository %s from '%s' to '%s'" %
- (str(self.source), self.url, tmpdir, self.mirror)) from e
+ raise SourceError("{}: Failed to move cloned git repository {} from '{}' to '{}'"
+ .format(str(self.source), self.url, tmpdir, self.mirror)) from e
def fetch(self):
self.source.call([self.source.host_git, 'fetch', 'origin', '--prune'],
@@ -126,8 +126,8 @@ class GitMirror():
def assert_ref(self):
if not self.has_ref():
- raise SourceError("%s: expected ref '%s' was not found in git repository: '%s'" %
- (str(self.source), self.ref, self.url))
+ raise SourceError("{}: expected ref '{}' was not found in git repository: '{}'"
+ .format(str(self.source), self.ref, self.url))
def latest_commit(self, tracking):
_, output = self.source.check_output(
@@ -212,14 +212,14 @@ class GitMirror():
# fail if the commit hash is invalid
if len(submodule_commit) != 40:
- raise SourceError("%s: Error reading commit information for submodule '%s'" %
- (str(self.source), submodule))
+ raise SourceError("{}: Error reading commit information for submodule '{}'"
+ .format(str(self.source), submodule))
return submodule_commit
else:
- raise SourceError("%s: Failed to read commit information for submodule '%s'" %
- (str(self.source), submodule))
+ raise SourceError("{}: Failed to read commit information for submodule '{}'"
+ .format(str(self.source), submodule))
class GitSource(Source):
diff --git a/buildstream/plugins/sources/local.py b/buildstream/plugins/sources/local.py
index 02486dffb..d513b897e 100644
--- a/buildstream/plugins/sources/local.py
+++ b/buildstream/plugins/sources/local.py
@@ -50,7 +50,7 @@ class LocalSource(Source):
def preflight(self):
# Check if the configured file or directory really exists
if not os.path.exists(self.fullpath):
- raise SourceError("Specified path '%s' does not exist" % self.path)
+ raise SourceError("Specified path '{}' does not exist".format(self.path))
def get_unique_key(self):
# Get a list of tuples of the the project relative paths and fullpaths
diff --git a/buildstream/plugins/sources/patch.py b/buildstream/plugins/sources/patch.py
index 9da6ade40..8ff8b1162 100644
--- a/buildstream/plugins/sources/patch.py
+++ b/buildstream/plugins/sources/patch.py
@@ -53,9 +53,9 @@ class PatchSource(Source):
def preflight(self):
# Check if the configured file really exists
if not os.path.exists(self.fullpath):
- raise SourceError("Specified path '%s' does not exist" % self.path)
+ raise SourceError("Specified path '{}' does not exist".format(self.path))
elif not os.path.isfile(self.fullpath):
- raise SourceError("Specified path '%s' must be a file" % self.path)
+ raise SourceError("Specified path '{}' must be a file".format(self.path))
# Check if patch is installed, get the binary at the same time
self.host_patch = utils.get_host_tool("patch")
diff --git a/buildstream/source.py b/buildstream/source.py
index 5c97a5743..71aa7e358 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -150,7 +150,7 @@ class Source(Plugin):
Returns:
(:class:`.Consistency`): The source consistency
"""
- raise ImplError("Source plugin '%s' does not implement get_consistency()" % self.get_kind())
+ raise ImplError("Source plugin '{}' does not implement get_consistency()".format(self.get_kind()))
def get_ref(self):
"""Fetch the internal ref, however it is represented
@@ -164,7 +164,7 @@ class Source(Plugin):
in a VCS or a tarball's checksum. Usually the reference is a string,
but the plugin may choose to represent it with a tuple or such.
"""
- raise ImplError("Source plugin '%s' does not implement get_ref()" % self.get_kind())
+ raise ImplError("Source plugin '{}' does not implement get_ref()".format(self.get_kind()))
def set_ref(self, ref, node):
"""Applies the internal ref, however it is represented
@@ -177,7 +177,7 @@ class Source(Plugin):
See :func:`~buildstream.source.Source.get_ref` for a discussion on
the *ref* parameter.
"""
- raise ImplError("Source plugin '%s' does not implement set_ref()" % self.get_kind())
+ raise ImplError("Source plugin '{}' does not implement set_ref()".format(self.get_kind()))
def track(self):
"""Resolve a new ref from the plugin's track option
@@ -210,7 +210,7 @@ class Source(Plugin):
Implementors should raise :class:`.SourceError` if the there is some
network error or if the source reference could not be matched.
"""
- raise ImplError("Source plugin '%s' does not implement fetch()" % self.get_kind())
+ raise ImplError("Source plugin '{}' does not implement fetch()".format(self.get_kind()))
def stage(self, directory):
"""Stage the sources to a directory
@@ -227,7 +227,7 @@ class Source(Plugin):
Implementors should raise :class:`.SourceError` when encountering
some system error.
"""
- raise ImplError("Source plugin '%s' does not implement stage()" % self.get_kind())
+ raise ImplError("Source plugin '{}' does not implement stage()".format(self.get_kind()))
def init_workspace(self, directory):
"""Initialises a new workspace
diff --git a/buildstream/utils.py b/buildstream/utils.py
index f49e69fc7..57830f8a4 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -433,7 +433,7 @@ def get_host_tool(name):
program_path = shutil.which(name, path=search_path)
if not program_path:
- raise ProgramNotFoundError("Did not find '%s' in PATH: %s" % (name, search_path))
+ raise ProgramNotFoundError("Did not find '{}' in PATH: {}".format(name, search_path))
return program_path
@@ -500,7 +500,7 @@ def _copy_directories(srcdir, destdir, target):
yield (new_dir, mode)
else:
raise OSError('Source directory tree has file where '
- 'directory expected: %s' % dir)
+ 'directory expected: {}'.format(dir))
def _ensure_real_directory(root, destpath):
@@ -515,8 +515,8 @@ def _ensure_real_directory(root, destpath):
if not realpath.startswith(os.path.realpath(root)):
raise IOError('Destination path resolves to a path outside ' +
'of the staging area\n\n' +
- ' Destination path: %s\n' % destpath +
- ' Real path: %s' % realpath)
+ ' Destination path: {}\n'.format(destpath) +
+ ' Real path: {}'.format(realpath))
# Ensure the real destination path exists before trying to get the mode
# of the real destination path.
@@ -592,8 +592,8 @@ def _process_list(srcdir, destdir, filelist, actionfunc, result, ignore_missing=
dest_stat = os.lstat(os.path.realpath(destpath))
if not stat.S_ISDIR(dest_stat.st_mode):
- raise OSError('Destination not a directory. source has %s'
- ' destination has %s' % (srcpath, destpath))
+ raise OSError('Destination not a directory. source has {}'
+ ' destination has {}'.format(srcpath, destpath))
permissions.append((destpath, os.stat(srcpath).st_mode))
elif stat.S_ISLNK(mode):
@@ -626,7 +626,7 @@ def _process_list(srcdir, destdir, filelist, actionfunc, result, ignore_missing=
else:
# Unsupported type.
- raise OSError('Cannot extract %s into staging-area. Unsupported type.' % srcpath)
+ raise OSError('Cannot extract {} into staging-area. Unsupported type.'.format(srcpath))
# Write directory permissions now that all files have been written
for d, perms in permissions:
@@ -939,7 +939,7 @@ def _glob2re(pat):
stuff = '^' + stuff[1:]
elif stuff[0] == '^':
stuff = '\\' + stuff
- res = '%s[%s]' % (res, stuff)
+ res = '{}[{}]'.format(res, stuff)
else:
res = res + re.escape(c)
return res + '\Z(?ms)'
diff --git a/tests/project/data/plugins/elements/custom.py b/tests/project/data/plugins/elements/custom.py
index e27e859e5..c18c234a9 100644
--- a/tests/project/data/plugins/elements/custom.py
+++ b/tests/project/data/plugins/elements/custom.py
@@ -4,7 +4,7 @@ from buildstream import Element
class CustomElement(Element):
def configure(self, node):
- print("Element Data: %s" % node)
+ print("Element Data: {}".format(node))
self.node_validate(node, ['configuration'])
self.configuration = self.node_subst_member(node, "configuration", '')
diff --git a/tests/project/data/plugins/sources/custom.py b/tests/project/data/plugins/sources/custom.py
index def1d3cd1..54c372bac 100644
--- a/tests/project/data/plugins/sources/custom.py
+++ b/tests/project/data/plugins/sources/custom.py
@@ -4,7 +4,7 @@ from buildstream import Source, Consistency
class CustomSource(Source):
def configure(self, node):
- print("Source Data: %s" % node)
+ print("Source Data: {}".format(node))
self.node_validate(node, ['configuration'] + Source.COMMON_CONFIG_KEYS)
self.configuration = self.node_get_member(node, str, "configuration")
diff --git a/tests/variables/variables.py b/tests/variables/variables.py
index 7562857f9..0352ecd27 100644
--- a/tests/variables/variables.py
+++ b/tests/variables/variables.py
@@ -32,8 +32,8 @@ def assert_command(datafiles, tmpdir, target, command, expected):
assert(commands.get(command) is not None)
assert(len(commands[command]) > 0)
- print("Commands:\n%s" % commands[command][0])
- print("Expected:\n%s" % expected)
+ print("Commands:\n{}".format(commands[command][0]))
+ print("Expected:\n{}".format(expected))
assert(commands[command][0] == expected)