Skip to content

Commit b05248a

Browse files
committed
Use f-strings instead of %
1 parent 2e30554 commit b05248a

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

pycheribuild/projects/cross/dlmalloc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ def setup(self):
8383
self.CFLAGS.append("-DCAPREVOKE")
8484

8585
if self.qmabs:
86-
self.CFLAGS.append("-DDEFAULT_MAX_FREEBUFBYTES=%d" % self.qmabs)
86+
self.CFLAGS.append(f"-DDEFAULT_MAX_FREEBUFBYTES={self.qmabs}")
8787

8888
if self.qmratio:
89-
self.CFLAGS.append("-DDEFAULT_FREEBUF_PERCENT=%f" % self.qmratio)
89+
self.CFLAGS.append(f"-DDEFAULT_FREEBUF_PERCENT={self.qmratio:f}")
9090

9191
if self.qmmin:
92-
self.CFLAGS.append("-DDEFAULT_MIN_FREEBUFBYTES=%d" % self.qmmin)
92+
self.CFLAGS.append(f"-DDEFAULT_MIN_FREEBUFBYTES={self.qmmin}")
9393

9494
if self.consolidate_on_free:
9595
self.CFLAGS.append("-DCONSOLIDATE_ON_FREE=1")
@@ -107,7 +107,7 @@ def setup(self):
107107
self.CFLAGS.append("-DSUPPORT_UNMAP=0")
108108

109109
if self.unmap_threshold:
110-
self.CFLAGS.append("-DDEFAULT_UNMAP_THRESHOLD=%d" % self.unmap_threshold)
110+
self.CFLAGS.append(f"-DDEFAULT_UNMAP_THRESHOLD={self.unmap_threshold}")
111111

112112
if not self.quar_unsafe:
113113
self.CFLAGS.append("-DSAFE_FREEBUF")

pycheribuild/projects/cross/snmalloc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __init__(self, *args, **kwargs):
112112
)
113113

114114
if self.decommit is not None:
115-
self.COMMON_FLAGS.append("-DUSE_DECOMMIT_STRATEGY=%s" % self.decommit)
115+
self.COMMON_FLAGS.append(f"-DUSE_DECOMMIT_STRATEGY={self.decommit}")
116116

117117
if self.qpathresh is not None:
118118
self.COMMON_FLAGS.append("-DSNMALLOC_QUARANTINE_PER_ALLOC_THRESHOLD=%d" % self.qpathresh)

pycheribuild/projects/run_fvp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,11 +814,11 @@ def add_hostbridge_params(*params):
814814
continue
815815
hg = x.split("=")
816816
if len(hg) != 2:
817-
self.fatal("Bad extra-tcp-forwarding (not just one '=' in '%s')" % x)
817+
self.fatal(f"Bad extra-tcp-forwarding (not just one '=' in '{x}')")
818818
continue
819819
gaddrport = hg[1].split(":")
820820
if len(gaddrport) > 2:
821-
self.fatal("Bad extra-tcp-forwarding (excess ':' in '%s')" % x)
821+
self.fatal(f"Bad extra-tcp-forwarding (excess ':' in '{x}')")
822822
continue
823823
tcp_ports += gaddrport[-1] # either just port or last in "host:port".split(":")
824824

pycheribuild/projects/run_qemu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def add_smb_or_9p_dir(directory, target, share_name=None, readonly=False):
512512
# QEMU insists on having : field delimeters; add if not given
513513
hg = x.split("=")
514514
if len(hg) != 2:
515-
self.fatal("Bad extra-tcp-forwarding (not just one '=' in '%s')" % x)
515+
self.fatal(f"Bad extra-tcp-forwarding (not just one '=' in '{x}')")
516516
(h, g) = hg
517517
if ":" not in h:
518518
h = ":" + h

pycheribuild/projects/sdk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def build_cheridis(self):
9595
self.makedirs(self.config.cheri_sdk_bindir)
9696
self.run_cmd(
9797
"cc",
98-
'-DLLVM_PATH="%s/"' % str(self.config.cheri_sdk_bindir),
98+
f'-DLLVM_PATH="{self.config.cheri_sdk_bindir}/"',
9999
"-x",
100100
"c",
101101
"-",

0 commit comments

Comments
 (0)