Skip to content

Commit 87fbbe5

Browse files
authored
Merge pull request #111 from roberthdevries/use-modern-f-strings
Use modern f-strings replacing str.format().
2 parents efe131e + a60f822 commit 87fbbe5

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

scripts/build_ffi.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ def wolfssl_lib_dir(local_wolfssl=None, fips=False):
101101
return lib_dir
102102

103103
def call(cmd):
104-
print("Calling: '{}' from working directory {}".format(cmd, os.getcwd()))
104+
print(f"Calling: '{cmd}' from working directory {os.getcwd()}")
105105

106106
old_env = os.environ["PATH"]
107-
os.environ["PATH"] = "{}:{}".format(WOLFSSL_SRC_PATH, old_env)
107+
os.environ["PATH"] = f"{WOLFSSL_SRC_PATH}:{old_env}"
108108
subprocess.check_call(cmd, shell=True, env=os.environ)
109109
os.environ["PATH"] = old_env
110110

@@ -142,9 +142,9 @@ def checkout_version(version):
142142
).strip().decode().split("\n")
143143

144144
if version != "master" and version not in tags:
145-
call("git fetch --depth=1 origin tag {}".format(version))
145+
call(f"git fetch --depth=1 origin tag {version}")
146146

147-
call("git checkout --force {}".format(version))
147+
call(f"git checkout --force {version}")
148148

149149
return True # rebuild needed
150150

@@ -171,7 +171,7 @@ def make_flags(prefix, fips):
171171
"""
172172
if sys.platform == "win32":
173173
flags = []
174-
flags.append("-DCMAKE_INSTALL_PREFIX={}".format(prefix))
174+
flags.append(f"-DCMAKE_INSTALL_PREFIX={prefix}")
175175
flags.append("-DWOLFSSL_CRYPT_TESTS=no")
176176
flags.append("-DWOLFSSL_EXAMPLES=no")
177177
flags.append("-DBUILD_SHARED_LIBS=no")
@@ -188,7 +188,7 @@ def make_flags(prefix, fips):
188188
flags.append("CFLAGS=-fPIC")
189189

190190
# install location
191-
flags.append("--prefix={}".format(prefix))
191+
flags.append(f"--prefix={prefix}")
192192

193193
# crypt only, lib only
194194
flags.append("--enable-cryptonly")
@@ -261,7 +261,7 @@ def make(configure_flags, fips=False):
261261
raise Exception("Cannot build wolfSSL FIPS from git repo.")
262262

263263
with chdir(build_path):
264-
call("cmake {} ..".format(configure_flags))
264+
call(f"cmake {configure_flags} ..")
265265
call("cmake --build . --config Release")
266266
call("cmake --install . --config Release")
267267
else:
@@ -274,7 +274,7 @@ def make(configure_flags, fips=False):
274274
call("libtoolize")
275275
call("./autogen.sh")
276276

277-
call("./configure {}".format(configure_flags))
277+
call(f"./configure {configure_flags}")
278278
call("make")
279279
call("make install")
280280

@@ -1376,9 +1376,9 @@ def main(ffibuilder):
13761376

13771377
local_wolfssl = os.environ.get("USE_LOCAL_WOLFSSL")
13781378
if local_wolfssl:
1379-
print("Using local wolfSSL at {}.".format(local_wolfssl))
1379+
print(f"Using local wolfSSL at {local_wolfssl}.")
13801380
if not os.path.exists(local_wolfssl):
1381-
e = "Local wolfssl installation path {} doesn't exist.".format(local_wolfssl)
1381+
e = f"Local wolfssl installation path {local_wolfssl} doesn't exist."
13821382
raise FileNotFoundError(e)
13831383

13841384
if not local_wolfssl:

0 commit comments

Comments
 (0)