More usage of f-strings. NFC

Convert remaining string concatenations, `%`-formatting, and `.format()`
calls to f-strings. Followup to #1722.

Also remove redundant `str()` calls and `!s` conversions in logging and
error helpers (`errlog`, `debug_print`, `print`, `exit_with_error`), and
inline the single-use `emscripten_releases_download_url_template`
constant as an f-string.
diff --git a/bazel/emscripten_toolchain/link_wrapper.py b/bazel/emscripten_toolchain/link_wrapper.py
index 79a3fa7..66636eb 100644
--- a/bazel/emscripten_toolchain/link_wrapper.py
+++ b/bazel/emscripten_toolchain/link_wrapper.py
@@ -27,7 +27,7 @@
 
 # Re-write response file if needed.
 if any(' ' in a for a in param_file_args):
-    new_param_filename = param_filename + '.modified'
+    new_param_filename = f'{param_filename}.modified'
     with open(new_param_filename, 'w') as f:
         for param in param_file_args:
             if ' ' in param:
@@ -35,7 +35,7 @@
             else:
                 f.write(param)
             f.write('\n')
-    sys.argv[1] = '@' + new_param_filename
+    sys.argv[1] = f'@{new_param_filename}'
 
 emxx_py = os.path.join(os.environ['EMSCRIPTEN'], 'em++.py')
 rtn = subprocess.call([sys.executable, emxx_py, *sys.argv[1:]])
@@ -60,11 +60,11 @@
 
     # If the output name has no extension, give it the appropriate extension.
     if not base_name_split[1]:
-        os.replace(output_file, output_file + '.' + oformat)
+        os.replace(output_file, f'{output_file}.{oformat}')
 
     # If the output name does have an extension and it matches the output format,
     # change the base_name so it doesn't have an extension.
-    elif base_name_split[1] == '.' + oformat:
+    elif base_name_split[1] == f'.{oformat}':
         base_name = base_name_split[0]
 
     # If the output name does have an extension and it does not match the output
@@ -76,7 +76,7 @@
     # Please don't do that.
     else:
         base_name = base_name_split[0]
-        os.replace(output_file, os.path.join(outdir, base_name + '.' + oformat))
+        os.replace(output_file, os.path.join(outdir, f'{base_name}.{oformat}'))
 
 files = []
 extensions = [
@@ -96,8 +96,8 @@
     if os.path.exists(os.path.join(outdir, filename)):
         files.append(filename)
 
-wasm_base = os.path.join(outdir, base_name + '.wasm')
-if os.path.exists(wasm_base + '.debug.wasm') and os.path.exists(wasm_base):
+wasm_base = os.path.join(outdir, f'{base_name}.wasm')
+if os.path.exists(f'{wasm_base}.debug.wasm') and os.path.exists(wasm_base):
     # If we have a .wasm.debug.wasm file and a .wasm file, we need to rewrite the
     # section in the .wasm file that refers to it. The path that's in there
     # is the blaze output path; we want it to be just the filename.
@@ -116,11 +116,12 @@
 
         # Next we need to convert length of the filename to LEB128.
         # Start by converting the length of the filename to a bit string.
-        bit_string = f"{len(base_name + '.wasm.debug.wasm'):b}"
+        debug_filename = f'{base_name}.wasm.debug.wasm'
+        bit_string = f'{len(debug_filename):b}'
 
         # Pad the bit string with 0s so that its length is a multiple of 7.
         while len(bit_string) % 7 != 0:
-            bit_string = '0' + bit_string
+            bit_string = f'0{bit_string}'
 
         # Break up our bit string into chunks of 7.
         # We do this backwards because the final format is little-endian.
@@ -130,13 +131,14 @@
             if i != 0:
                 # Every chunk except the last one needs to be prepended with '1'.
                 # The length of each chunk is 7, so that one has an implicit '0'.
-                binary_part = '1' + binary_part
+                binary_part = f'1{binary_part}'
             final_bytes.append(int(binary_part, 2))
         # Finally, add the actual filename.
-        final_bytes.extend((base_name + '.wasm.debug.wasm').encode())
+        final_bytes.extend(debug_filename.encode())
 
         # Write our length + filename bytes to a temp file.
-        with open(base_name + '_debugsection.tmp', 'wb+') as f:
+        debugsection_filename = f'{base_name}_debugsection.tmp'
+        with open(debugsection_filename, 'wb+') as f:
             f.write(final_bytes)
             f.close()
 
@@ -149,7 +151,7 @@
         subprocess.check_call([
             llvm_objcopy,
             wasm_base,
-            '--add-section=external_debug_info=' + base_name + '_debugsection.tmp'])
+            f'--add-section=external_debug_info={debugsection_filename}'])
 
 # Make sure we have at least one output file.
 if not files:
@@ -157,8 +159,9 @@
     sys.exit(1)
 
 # cc_binary must output exactly one file; put all the output files in a tarball.
-cmd = ['tar', 'cf', base_name + '.tar', *files]
+tar_file = f'{base_name}.tar'
+cmd = ['tar', 'cf', tar_file, *files]
 subprocess.check_call(cmd, cwd=outdir)
-os.replace(os.path.join(outdir, base_name + '.tar'), output_file)
+os.replace(os.path.join(outdir, tar_file), output_file)
 
 sys.exit(0)
diff --git a/bazel/emscripten_toolchain/wasm_binary.py b/bazel/emscripten_toolchain/wasm_binary.py
index b67b88a..064cbc8 100644
--- a/bazel/emscripten_toolchain/wasm_binary.py
+++ b/bazel/emscripten_toolchain/wasm_binary.py
@@ -38,7 +38,7 @@
     tar = tarfile.open(args.archive)
 
     for member in tar.getmembers():
-        extname = '.' + member.name.split('.', 1)[1]
+        extname = f".{member.name.split('.', 1)[1]}"
         for idx, output in enumerate(args.outputs):
             if output.endswith(extname):
                 member_file = tar.extractfile(member)
@@ -48,7 +48,7 @@
                 break
 
     for output in args.outputs:
-        extname = '.' + output.split('.', 1)[1]
+        extname = f".{output.split('.', 1)[1]}"
         if args.allow_empty_outputs:
             ensure(output)
         else:
diff --git a/emsdk.py b/emsdk.py
index aee5bfa..326e519 100644
--- a/emsdk.py
+++ b/emsdk.py
@@ -36,8 +36,6 @@
 
 emscripten_releases_repo = 'https://chromium.googlesource.com/emscripten-releases'
 
-emscripten_releases_download_url_template = emscripten_releases_builds_url + "%s/%s/wasm-binaries%s.%s"
-
 # This was previously `master.zip` but we are transitioning to `main` and
 # `HEAD.zip` works for both cases.  In future we could switch this to
 # `main.zip` perhaps.
@@ -155,7 +153,7 @@
 elif machine.startswith('s390x'):
     ARCH = 's390x'
 else:
-    exit_with_error('unknown machine architecture: ' + machine)
+    exit_with_error(f'unknown machine architecture: {machine}')
 
 
 # Don't saturate all cores to not steal the whole system, but be aggressive.
@@ -262,7 +260,7 @@
         # of Visual Studio and Build Tools.
         stdout = run_get_output([vswhere_path, '-latest', '-products', '*',
                                  '-prerelease', '-version', f'[{version}.0,{version + 1}.0)',
-                                 '-requires', 'Microsoft.VisualStudio.Component.VC.Tools.' + tools_arch,
+                                 '-requires', f'Microsoft.VisualStudio.Component.VC.Tools.{tools_arch}',
                                  '-property', 'installationPath', '-format', 'json'])
         json_output = json.loads(stdout)
         return str(json_output[0]['installationPath'])
@@ -321,7 +319,7 @@
                 raise exc_info[1]
         shutil.rmtree(d, onerror=remove_readonly_and_try_again)
     except Exception as e:
-        debug_print('remove_tree threw an exception, ignoring: ' + str(e))
+        debug_print(f'remove_tree threw an exception, ignoring: {e}')
 
 
 def win_set_environment_variable_direct(key, value, system=True):
@@ -345,7 +343,7 @@
                             'This can be done for example by holding down the Ctrl and Shift keys '
                             'while opening a command prompt in start menu.')
         errlog(f'Failed to write environment variable {key}:')
-        errlog(str(e))
+        errlog(e)
         return False
     finally:
         if folder is not None:
@@ -383,7 +381,7 @@
         if e.args[0] != 2:
             # 'The system cannot find the file specified.'
             errlog(f'Failed to read environment variable {key}:')
-            errlog(str(e))
+            errlog(e)
         return None
     return value
 
@@ -402,7 +400,7 @@
                 cmd = ['REG', 'DELETE', 'SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment', '/V', key, '/f']
             else:
                 cmd = ['REG', 'DELETE', 'HKCU\\Environment', '/V', key, '/f']
-            debug_print(str(cmd))
+            debug_print(cmd)
             subprocess.call(cmd, stdout=subprocess.PIPE)
         except Exception:
             return False
@@ -418,7 +416,7 @@
                             'A value this long cannot be set via command line: please add the environment variable '
                             'specified above to system environment manually via Control Panel.')
         cmd = ['SETX', key, value]
-        debug_print(str(cmd))
+        debug_print(cmd)
         retcode = subprocess.call(cmd, stdout=subprocess.PIPE)
         if retcode != 0:
             errlog(f'ERROR! Failed to set environment variable {key}={value}. You may need to set it manually.')
@@ -426,7 +424,7 @@
             return True
     except Exception as e:
         errlog(f'ERROR! Failed to set environment variable {key}={value}:')
-        errlog(str(e))
+        errlog(e)
         errlog('You may need to set it manually.')
 
     return False
@@ -463,7 +461,7 @@
           SMTO_BLOCK,        # fuFlags: Wait for message to be sent or timeout
           100)               # uTimeout: 100ms
     except Exception as e:
-        errlog('SendMessageTimeout failed with error: ' + str(e))
+        errlog(f'SendMessageTimeout failed with error: {e}')
 
 
 def win_delete_environment_variable(key, system=True, user=True):
@@ -841,15 +839,15 @@
         if target_is_tag:
             ret = run([GIT(), 'checkout', '--recurse-submodules', '--quiet', branch_or_tag], repo_path)
         else:
-            local_branch_prefix = (remote_name + '_') if remote_name != 'origin' else ''
-            ret = run([GIT(), 'checkout', '--recurse-submodules', '--quiet', '-B', local_branch_prefix + branch_or_tag,
-                       '--track', remote_name + '/' + branch_or_tag], repo_path)
+            local_branch_prefix = f'{remote_name}_' if remote_name != 'origin' else ''
+            ret = run([GIT(), 'checkout', '--recurse-submodules', '--quiet', '-B', f'{local_branch_prefix}{branch_or_tag}',
+                       '--track', f'{remote_name}/{branch_or_tag}'], repo_path)
         if ret != 0:
             return False
         if not target_is_tag:
             # update branch to latest (not needed for tags)
             # this line assumes that the user has not gone and made local changes to the repo
-            ret = run([GIT(), 'merge', '--ff-only', remote_name + '/' + branch_or_tag], repo_path)
+            ret = run([GIT(), 'merge', '--ff-only', f'{remote_name}/{branch_or_tag}'], repo_path)
         if ret != 0:
             return False
         run([GIT(), 'submodule', 'update', '--init'], repo_path, check=False)
@@ -857,7 +855,7 @@
         errlog('git operation failed!')
         return False
     print(f"Successfully updated and checked out branch/tag '{branch_or_tag}' on repository '{repo_path}'")
-    print("Current repository version: " + git_repo_version(repo_path))
+    print(f'Current repository version: {git_repo_version(repo_path)}')
     return True
 
 
@@ -889,9 +887,9 @@
     bitness_suffix = '_32' if tool.bitness == 32 else '_64'
 
     if tool.git_branch:
-        build_dir = 'build_' + tool.git_branch.replace(os.sep, '-') + generator_suffix + bitness_suffix
+        build_dir = f"build_{tool.git_branch.replace(os.sep, '-')}{generator_suffix}{bitness_suffix}"
     else:
-        build_dir = 'build_' + tool.version + generator_suffix + bitness_suffix
+        build_dir = f'build_{tool.version}{generator_suffix}{bitness_suffix}'
     return build_dir
 
 
@@ -993,17 +991,17 @@
         # To enable each MSBuild.exe instance to also compile several .cpp files in parallel inside a single project, pass the extra
         # MSBuild.exe specific "Multi-ToolTask" (MTT) setting /p:CL_MPCount. This enables each MSBuild.exe to parallelize builds wide.
         # This requires CMake 3.12 or newer.
-        make += ['-j', str(CPU_CORES), '--', '/p:CL_MPCount=' + str(CPU_CORES)]
+        make += ['-j', str(CPU_CORES), '--', f'/p:CL_MPCount={CPU_CORES}']
     else:
         # Pass -j to native make, CMake might not support -j option.
         make += ['--', '-j', str(CPU_CORES)]
 
     # Build
-    print('Running build: ' + str(make))
+    print(f'Running build: {make}')
     ret = subprocess.call(make, cwd=build_root, env=build_env())
     if ret != 0:
         errlog(f'Build failed with exit code {ret}!')
-        errlog('Working directory: ' + build_root)
+        errlog(f'Working directory: {build_root}')
         return False
 
     return True
@@ -1026,7 +1024,7 @@
     if not os.path.isdir(build_root):
         # Create build output directory if it doesn't yet exist.
         os.mkdir(build_root)
-    cmdline = [find_cmake(), '-DCMAKE_BUILD_TYPE=' + build_type, '-DPYTHON_EXECUTABLE=' + sys.executable]
+    cmdline = [find_cmake(), f'-DCMAKE_BUILD_TYPE={build_type}', f'-DPYTHON_EXECUTABLE={sys.executable}']
     if generator:
         cmdline += ['-G', generator]
     # Target macOS 11.0 Big Sur at minimum, to support older Mac devices.
@@ -1048,14 +1046,14 @@
 
     # Create a file 'recmake.bat/sh' in the build root that user can call to
     # manually recmake the build tree with the previous build params
-    re_cmake_script = os.path.join(build_root, 'recmake.' + ('bat' if WINDOWS else 'sh'))
+    re_cmake_script = os.path.join(build_root, 'recmake.bat' if WINDOWS else 'recmake.sh')
     write_file(re_cmake_script, ' '.join(map(quote_parens, cmdline)))
     try:
         subprocess.check_call(cmdline, cwd=build_root, env=build_env())
     except Exception as e:
         errlog('CMake invocation failed due to exception')
         errlog(f'Working directory: {build_root}')
-        errlog(str(e))
+        errlog(e)
         return False
 
     return True
@@ -1103,7 +1101,7 @@
         # Instead of appending it into the CMake generator line, it is specified
         # with a -A arch parameter.
         args += ['-A', cmake_target_platform(tool)]
-        args += ['-Thost=' + cmake_host_platform()]
+        args += [f'-Thost={cmake_host_platform()}']
     elif 'Visual Studio' in CMAKE_GENERATOR and tool.bitness == 64:
         cmake_generator += ' Win64'
         args += ['-Thost=x64']
@@ -1154,11 +1152,12 @@
     else:
         targets_to_build = 'WebAssembly'
     cmake_generator, args = get_generator_and_config_args(tool)
-    args += ['-DLLVM_TARGETS_TO_BUILD=' + targets_to_build,
+    assertions_arg = 'ON' if enable_assertions else 'OFF'
+    args += [f'-DLLVM_TARGETS_TO_BUILD={targets_to_build}',
              '-DLLVM_INCLUDE_EXAMPLES=OFF',
-             '-DLLVM_INCLUDE_TESTS=' + tests_arg,
-             '-DCLANG_INCLUDE_TESTS=' + tests_arg,
-             '-DLLVM_ENABLE_ASSERTIONS=' + ('ON' if enable_assertions else 'OFF'),
+             f'-DLLVM_INCLUDE_TESTS={tests_arg}',
+             f'-DCLANG_INCLUDE_TESTS={tests_arg}',
+             f'-DLLVM_ENABLE_ASSERTIONS={assertions_arg}',
              # Disable optional LLVM dependencies, these can cause unwanted .so dependencies
              # that prevent distributing the generated compiler for end users.
              '-DLLVM_ENABLE_LIBXML2=OFF', '-DLLDB_ENABLE_LIBEDIT=OFF',
@@ -1177,7 +1176,7 @@
 
     if os.getenv('LLVM_CMAKE_ARGS'):
         extra_args = os.environ['LLVM_CMAKE_ARGS'].split(',')
-        print('Passing the following extra arguments to LLVM CMake configuration: ' + str(extra_args))
+        print(f'Passing the following extra arguments to LLVM CMake configuration: {extra_args}')
         args += extra_args
 
     cmakelists_dir = os.path.join(llvm_src_root, 'llvm')
@@ -1280,7 +1279,7 @@
     npx = os.path.join(os.path.abspath(node_path), 'npx' + ('.cmd' if WINDOWS else ''))
     print(f'Node: {npx}')
     cmd = [npx, '@puppeteer/browsers', 'install', f'chrome@{tool.version}']
-    print(str(cmd))
+    print(cmd)
     output = subprocess.check_output(cmd, env=node_env).decode('utf-8')
     chrome_path = output[output.find(' ') + 1:].strip()
     print(f'Chrome: {chrome_path}')
@@ -1331,7 +1330,7 @@
     else:
         firefox_version = os.path.basename(scraper.filename).split("firefox-")[1].split(".en-US")[0]
 
-    print('Target Firefox version: ' + firefox_version)
+    print(f'Target Firefox version: {firefox_version}')
     if tool.version in {'latest', 'latest-esr', 'latest-beta', 'nightly'}:
         pretend_version_dir = os.path.normpath(tool.installation_path())
         orig_version = tool.version
@@ -1352,7 +1351,7 @@
             write_file(os.path.join(pretend_version_dir, 'actual.txt'), os.path.relpath(root, EMSDK_PATH))
 
     # Check if already installed
-    print('Firefox installation root directory: ' + root)
+    print(f'Firefox installation root directory: {root}')
     exe_dir = os.path.join(root, 'Contents', 'MacOS') if MACOS else root
     firefox_exe = os.path.join(exe_dir, exe_suffix('firefox'))
     if os.path.isfile(firefox_exe):
@@ -1360,16 +1359,16 @@
         save_actual_version()
         return True
 
-    print('Downloading Firefox from ' + scraper.url)
+    print(f'Downloading Firefox from {scraper.url}')
     filename = scraper.download()
-    print('Finished downloading ' + filename)
+    print(f'Finished downloading {filename}')
 
     if not MACOS:
         os.makedirs(root, exist_ok=True)
 
     if extension == 'exe':
         # Uncompress the NSIS installer to 'install' Firefox
-        run(['C:\\Program Files\\7-Zip\\7z.exe', 'x', '-y', filename, '-o' + root])
+        run(['C:\\Program Files\\7-Zip\\7z.exe', 'x', '-y', filename, f'-o{root}'])
 
     if '.tar.' in filename:
         if filename.endswith('.tar.bz2'):
@@ -1413,7 +1412,7 @@
     # Remove a redundant subdirectory by moving installed files up one directory.
     if collapse_subdir and os.path.isdir(collapse_subdir):
         # Rename the parent subdirectory first, since we will be handling a nested `firefox/firefox/`
-        collapse = collapse_subdir + '_temp_renamed'
+        collapse = f'{collapse_subdir}_temp_renamed'
         os.rename(collapse_subdir, collapse)
 
         # Move all files up by one directory
@@ -1496,7 +1495,7 @@
         node_path = os.path.dirname(npm_fallback)
 
     env = os.environ.copy()
-    env["PATH"] = node_path + os.pathsep + env["PATH"]
+    env["PATH"] = f'{node_path}{os.pathsep}{env["PATH"]}'
     return env, node_path
 
 
@@ -1541,7 +1540,7 @@
             subprocess.check_call([sys.executable, os.path.join(directory, 'bootstrap.py')],
                                   cwd=directory, stdin=subprocess.DEVNULL, env=env, text=True)
         except subprocess.CalledProcessError as e:
-            errlog(f'Error running {e!s}')
+            errlog(f'Error running {e}')
             return False
 
         print('Done running: Emscripten bootstrap')
@@ -1790,7 +1789,7 @@
         return False
     print(f'Latest Node.js Nightly download available is "{latest_nightly}"')
 
-    output_dir = sdk_path('node/nightly-' + latest_nightly)
+    output_dir = sdk_path(f'node/nightly-{latest_nightly}')
     # Node.js zip structure quirk: Linux and macOS archives have a /bin,
     # Windows does not. Unify the file structures.
     if WINDOWS:
@@ -1871,10 +1870,10 @@
     if supports_cfgdir:
         cfg = cfg.replace(EMSDK_PATH, '$CFGDIR')
     else:
-        cfg = cfg.replace("'" + EMSDK_PATH, "emsdk_path + '")
+        cfg = cfg.replace(f"'{EMSDK_PATH}", "emsdk_path + '")
 
     if os.path.exists(EM_CONFIG_PATH):
-        backup_path = EM_CONFIG_PATH + ".old"
+        backup_path = f'{EM_CONFIG_PATH}.old'
         move_with_overwrite(EM_CONFIG_PATH, backup_path)
 
     write_file(EM_CONFIG_PATH, cfg)
@@ -1895,7 +1894,7 @@
         print('- To conveniently access emsdk tools from the command line,')
         print('  consider adding the following directories to your PATH:')
         for p in path_add:
-            print('    ' + p)
+            print(f'    {p}')
         print('- This can be done for the current shell by running:')
         emsdk_env, shell_config_file = get_emsdk_shell_env_configs()
         print(f'    source "{emsdk_env}"')
@@ -2117,7 +2116,7 @@
 
             # all paths are stored dynamically relative to the emsdk root, so
             # normalize those first.
-            config_value = EM_CONFIG_DICT[key].replace("emsdk_path + '", "'" + EMSDK_PATH).replace("$CFGDIR", EMSDK_PATH)
+            config_value = EM_CONFIG_DICT[key].replace("emsdk_path + '", f"'{EMSDK_PATH}").replace("$CFGDIR", EMSDK_PATH)
             config_value = config_value.strip("'")
             if config_value != value:
                 debug_print(f'{self} is not active, because key="{key}" has value "{config_value}" but should have value "{value}"')
@@ -2218,7 +2217,7 @@
             success = download_and_extract(self.url, self.installation_path(),
                                            filename_prefix=getattr(self, 'download_prefix', ''))
         else:
-            assert False, 'unhandled url type: ' + self.url
+            assert False, f'unhandled url type: {self.url}'
 
         if not success:
             exit_with_error("installation failed!")
@@ -2418,7 +2417,7 @@
     ]
 
     def check_binary(release, os_name, arch, ext):
-        url = emscripten_releases_download_url_template % (os_name, release, arch, ext)
+        url = f'{emscripten_releases_builds_url}{os_name}/{release}/wasm-binaries{arch}.{ext}'
         try:
             urlopen(url)
             return True
@@ -2499,7 +2498,7 @@
             load_releases_info.cached_info = json.loads(text)
         except Exception as e:
             print('Error parsing emscripten-releases-tags.json!')
-            exit_with_error(str(e))
+            exit_with_error(e)
 
     return load_releases_info.cached_info
 
@@ -2557,7 +2556,7 @@
         for dep in sdk.deps:
             tool = find_tool(dep)
             if not tool:
-                debug_print('missing dependency: ' + dep)
+                debug_print(f'missing dependency: {dep}')
                 return False
         return True
 
@@ -2821,7 +2820,7 @@
         if added_path:
             info('Adding directories to PATH:')
             for item in added_path:
-                info('PATH += ' + item)
+                info(f'PATH += {item}')
             info('')
 
     # A core variable EMSDK points to the root of Emscripten SDK directory.
@@ -3284,7 +3283,7 @@
                     if tool.can_be_installed() is True:
                         installed = '\tINSTALLED' if tool.is_installed() else ''
                     else:
-                        installed = '\tNot available: ' + tool.can_be_installed()
+                        installed = f'\tNot available: {tool.can_be_installed()}'
                     tool_is_active = tool.is_active()
                     tool_is_env_active = tool_is_active and tool.is_env_active()
                     if tool_is_env_active:
@@ -3311,10 +3310,10 @@
         print('Items marked with * are activated for the current user.')
         if has_partially_active_tools[0]:
             env_cmd = 'emsdk_env.bat' if WINDOWS else 'source ./emsdk_env.sh'
+            suffix = ', or call "emsdk activate --permanent <name_of_sdk>" to permanently activate them.' if WINDOWS else '.'
             print('Items marked with (*) are selected for use, '
                   'but your current shell environment is not configured to use them. '
-                  f'Type "{env_cmd}" to set up your current shell to use them' +
-                  (', or call "emsdk activate --permanent <name_of_sdk>" to permanently activate them.' if WINDOWS else '.'))
+                  f'Type "{env_cmd}" to set up your current shell to use them{suffix}')
         if not arg_old:
             print('')
             print("To access the historical archived versions, type 'emsdk list --old'")
diff --git a/scripts/create_release.py b/scripts/create_release.py
index 81ffa8a..5572ad8 100755
--- a/scripts/create_release.py
+++ b/scripts/create_release.py
@@ -51,7 +51,7 @@
     print(f'Creating new release: {new_version} -> {new_hash}')
     release_info['releases'][new_version] = new_hash
     if asserts_hash:
-        asserts_name = new_version + '-asserts'
+        asserts_name = f'{new_version}-asserts'
         release_info['releases'][asserts_name] = asserts_hash
 
     releases = [(k, v) for k, v in release_info['releases'].items()]
@@ -68,7 +68,7 @@
       [sys.executable, os.path.join(script_dir, 'update_bazel_workspace.py')],
       cwd=root_dir)
 
-    branch_name = 'version_' + new_version
+    branch_name = f'version_{new_version}'
 
     if options.gh_action:  # For GitHub Actions workflows
         with open(os.environ['GITHUB_ENV'], 'a') as f:
diff --git a/scripts/get_emscripten_revision_info.py b/scripts/get_emscripten_revision_info.py
index d0ad76e..f6508a8 100755
--- a/scripts/get_emscripten_revision_info.py
+++ b/scripts/get_emscripten_revision_info.py
@@ -35,7 +35,7 @@
 
 if __name__ == '__main__':
     emscripten_hash = get_latest_emscripten(TAGFILE)
-    print('Emscripten revision ' + emscripten_hash)
+    print(f'Emscripten revision {emscripten_hash}')
     if 'GITHUB_ENV' in os.environ:
         with open(os.environ['GITHUB_ENV'], 'a') as f:
             f.write(f'EMSCRIPTEN_HASH={emscripten_hash}')
diff --git a/scripts/update_bazel_workspace.py b/scripts/update_bazel_workspace.py
index ac7428b..4664d5c 100755
--- a/scripts/update_bazel_workspace.py
+++ b/scripts/update_bazel_workspace.py
@@ -16,9 +16,9 @@
 STORAGE_URL = 'https://storage.googleapis.com/webassembly/emscripten-releases-builds'
 
 EMSDK_ROOT = os.path.dirname(os.path.dirname(__file__))
-RELEASES_TAGS_FILE = EMSDK_ROOT + '/emscripten-releases-tags.json'
-BAZEL_REVISIONS_FILE = EMSDK_ROOT + '/bazel/revisions.bzl'
-BAZEL_MODULE_FILE = EMSDK_ROOT + '/bazel/MODULE.bazel'
+RELEASES_TAGS_FILE = f'{EMSDK_ROOT}/emscripten-releases-tags.json'
+BAZEL_REVISIONS_FILE = f'{EMSDK_ROOT}/bazel/revisions.bzl'
+BAZEL_MODULE_FILE = f'{EMSDK_ROOT}/bazel/MODULE.bazel'
 
 
 def get_latest_info():
diff --git a/scripts/update_node.py b/scripts/update_node.py
index b0d1ada..7a235d8 100755
--- a/scripts/update_node.py
+++ b/scripts/update_node.py
@@ -40,12 +40,12 @@
     for suffix in suffixes:
         filename = f'node-v{version}{suffix}'
         download_url = base + filename
-        print('Downloading: ' + download_url)
+        print(f'Downloading: {download_url}')
         urllib.request.urlretrieve(download_url, filename)
 
         if args.upload:
             upload_url = upload_base + filename
-            print('Uploading: ' + upload_url)
+            print(f'Uploading: {upload_url}')
             cmd = ['gsutil', 'cp', '-n', filename, upload_url]
             print(' '.join(cmd))
             subprocess.check_call(cmd)
diff --git a/scripts/update_python.py b/scripts/update_python.py
index d69c51f..cc91e64 100755
--- a/scripts/update_python.py
+++ b/scripts/update_python.py
@@ -85,7 +85,7 @@
 
     if '--upload' in sys.argv:
         upload_url = upload_base + out_filename
-        print('Uploading: ' + upload_url)
+        print(f'Uploading: {upload_url}')
         cmd = ['gsutil', 'cp', '-n', out_filename, upload_url]
         print(' '.join(cmd))
         check_call(cmd)
@@ -104,7 +104,7 @@
 
         # Append '-x86_64' or '-arm64' depending on current arch. (TODO: Do
         # this for Linux too, move this below?)
-        osname += '-' + platform.machine()
+        osname += f'-{platform.machine()}'
 
         for f in [os.path.join(prefix, 'lib', 'libintl.dylib'),
                   os.path.join(prefix, 'include', 'libintl.h'),
@@ -122,18 +122,18 @@
         check_call(['git', 'fetch'], cwd=src_dir)
     else:
         check_call(['git', 'clone', 'https://github.com/python/cpython'])
-    check_call(['git', 'checkout', 'v' + version], cwd=src_dir)
+    check_call(['git', 'checkout', f'v{version}'], cwd=src_dir)
 
     env = os.environ
     if sys.platform.startswith('darwin'):
         # Specify the min OS version we want the build to work on
         min_macos_version = '11.0'
-        min_macos_version_line = '-mmacosx-version-min=' + min_macos_version
-        build_flags = min_macos_version_line + ' -Werror=partial-availability'
+        min_macos_version_line = f'-mmacosx-version-min={min_macos_version}'
+        build_flags = f'{min_macos_version_line} -Werror=partial-availability'
         # Build against latest SDK, but issue an error if using any API that would not work on the min OS version
         env = env.copy()
         env['MACOSX_DEPLOYMENT_TARGET'] = min_macos_version
-        configure_args = ['CFLAGS=' + build_flags, 'CXXFLAGS=' + build_flags, 'LDFLAGS=' + min_macos_version_line]
+        configure_args = [f'CFLAGS={build_flags}', f'CXXFLAGS={build_flags}', f'LDFLAGS={min_macos_version_line}']
     else:
         configure_args = []
     check_call(['./configure', *configure_args], cwd=src_dir, env=env)
@@ -155,11 +155,11 @@
 
     dirname = f'python-{version}-{revision}'
     if os.path.isdir(dirname):
-        print('Erasing old build directory ' + dirname)
+        print(f'Erasing old build directory {dirname}')
         shutil.rmtree(dirname)
     os.rename(os.path.join(install_dir, 'usr', 'local'), dirname)
     tarball = f'python-{version}-{revision}-{osname}.tar.gz'
-    shutil.rmtree(os.path.join(dirname, 'lib', 'python' + major_minor_version, 'test'))
+    shutil.rmtree(os.path.join(dirname, 'lib', f'python{major_minor_version}', 'test'))
     shutil.rmtree(os.path.join(dirname, 'include'))
     for lib in glob.glob(os.path.join(dirname, 'lib', 'lib*.a')):
         os.remove(lib)
@@ -167,7 +167,7 @@
 
     print(f'Created: {tarball}')
     if '--upload' in sys.argv:
-        print('Uploading: ' + upload_base + tarball)
+        print(f'Uploading: {upload_base}{tarball}')
         check_call(['gsutil', 'cp', '-n', tarball, upload_base + tarball])
 
 
diff --git a/test/test.py b/test/test.py
index 5b2d601..45e7931 100755
--- a/test/test.py
+++ b/test/test.py
@@ -56,21 +56,22 @@
 
     if expected:
         for x in listify(expected):
-            assert x in stdout, 'expected output missing: ' + stdout + '\n[[[' + x + ']]]'
+            assert x in stdout, f'expected output missing: {stdout}\n[[[{x}]]]'
     if unexpected:
         for x in listify(unexpected):
-            assert x not in stdout, 'unexpected output present: ' + stdout + '\n[[[' + x + ']]]'
+            assert x not in stdout, f'unexpected output present: {stdout}\n[[[{x}]]]'
 
 
 def failing_call_with_output(cmd, expected, env=None):
     proc = subprocess.run(cmd.split(' '), capture_output=True, text=True, env=env)
     stdout = proc.stdout
     stderr = proc.stderr
+    output = [stdout, '\n========\n', stderr]
     if WINDOWS:
         print('warning: skipping part of failing_call_with_output() due to error codes not being propagated (see #592)')
     else:
-        assert proc.returncode, 'call must have failed: ' + str([stdout, '\n========\n', stderr])
-    assert expected in stdout or expected in stderr, 'call did not have the expected output: {}: {}'.format(expected, str([stdout, '\n========\n', stderr]))
+        assert proc.returncode, f'call must have failed: {output}'
+    assert expected in stdout or expected in stderr, f'call did not have the expected output: {expected}: {output}'
 
 
 def hack_emsdk(marker, replacement):
@@ -129,7 +130,7 @@
             expected = cache_building_messages
         elif is_expected is False:
             unexpected = cache_building_messages
-        checked_call_with_output(emcc + ' hello_world.c' + args,
+        checked_call_with_output(f'{emcc} hello_world.c{args}',
                                  expected=expected,
                                  unexpected=unexpected,
                                  stderr=subprocess.STDOUT)
@@ -137,7 +138,7 @@
     # The emsdk ships all system libraries so we don't expect to see any
     # cache population unless we explicly --clear-cache.
     do_build('', is_expected=False)
-    check_call(emcc + ' --clear-cache')
+    check_call(f'{emcc} --clear-cache')
     do_build(' -O2', is_expected=True)
     # Do another build at -O0.  In nwers SDK versions this generates
     # different libs, but not in older ones so don't assert here.
@@ -156,10 +157,10 @@
 def upstream_emcc(root='.'):
     emcc = os.path.join(root, 'upstream', 'emscripten', 'emcc')
     if WINDOWS:
-        if os.path.exists(emcc + '.exe'):
-            return emcc + '.exe'
+        if os.path.exists(f'{emcc}.exe'):
+            return f'{emcc}.exe'
         else:
-            return emcc + '.bat'
+            return f'{emcc}.bat'
     return emcc
 
 
@@ -221,25 +222,25 @@
     def test_unknown_arch(self):
         env = os.environ.copy()
         env['EMSDK_ARCH'] = 'mips'
-        failing_call_with_output(emsdk + ' install latest',
+        failing_call_with_output(f'{emsdk} install latest',
                                  expected='unknown machine architecture: mips',
                                  env=env)
 
     def test_wrong_bitness(self):
         env = os.environ.copy()
         env['EMSDK_ARCH'] = 'x86'
-        failing_call_with_output(emsdk + ' install sdk-latest-64bit',
+        failing_call_with_output(f'{emsdk} install sdk-latest-64bit',
                                  expected='is only provided for 64-bit OSe',
                                  env=env)
 
     def test_already_installed(self):
         # Test we don't re-download unnecessarily
-        checked_call_with_output(emsdk + ' install latest', expected='already installed', unexpected='Downloading:')
+        checked_call_with_output(f'{emsdk} install latest', expected='already installed', unexpected='Downloading:')
 
     def test_list(self):
         # Test we report installed tools properly. The latest version should be
         # installed, but not some random old one.
-        checked_call_with_output(emsdk + ' list', expected=TAGS['aliases']['latest'] + '    INSTALLED', unexpected='1.39.15    INSTALLED:')
+        checked_call_with_output(f'{emsdk} list', expected=f"{TAGS['aliases']['latest']}    INSTALLED", unexpected='1.39.15    INSTALLED:')
 
     def test_config_contents(self):
         print('test .emscripten contents')
@@ -285,9 +286,9 @@
 
         # Test the normal tools like node don't re-download on re-install
         print('another install must re-download')
-        checked_call_with_output(emsdk + ' uninstall node-24.19.0-64bit')
-        checked_call_with_output(emsdk + ' install node-24.19.0-64bit', expected='Downloading:', unexpected='already installed')
-        checked_call_with_output(emsdk + ' install node-24.19.0-64bit', unexpected='Downloading:', expected='already installed')
+        checked_call_with_output(f'{emsdk} uninstall node-24.19.0-64bit')
+        checked_call_with_output(f'{emsdk} install node-24.19.0-64bit', expected='Downloading:', unexpected='already installed')
+        checked_call_with_output(f'{emsdk} install node-24.19.0-64bit', unexpected='Downloading:', expected='already installed')
 
     def test_tot_upstream(self):
         print('test tot-upstream')
@@ -295,16 +296,16 @@
         with open(emconfig) as f:
             config = f.read()
         run_emsdk('activate tot-upstream')
-        self.addCleanup(remove_file, emconfig + '.old')
-        with open(emconfig + '.old') as f:
+        self.addCleanup(remove_file, f'{emconfig}.old')
+        with open(f'{emconfig}.old') as f:
             old_config = f.read()
         self.assertEqual(config, old_config)
         # TODO; test on latest as well
-        check_call(upstream_emcc() + ' hello_world.c')
+        check_call(f'{upstream_emcc()} hello_world.c')
 
     def test_closure(self):
         # Specifically test with `--closure` so we know that node_modules is working
-        check_call(upstream_emcc() + ' hello_world.c --closure=1')
+        check_call(f'{upstream_emcc()} hello_world.c --closure=1')
 
     def test_specific_version(self):
         if MACOS_ARM64:
@@ -312,7 +313,7 @@
         print('test specific release (new, short name)')
         run_emsdk('install 1.38.33')
         print('another install, but no need for re-download')
-        checked_call_with_output(emsdk + ' install 1.38.33', expected='Skipped', unexpected='Downloading:')
+        checked_call_with_output(f'{emsdk} install 1.38.33', expected='Skipped', unexpected='Downloading:')
         run_emsdk('activate 1.38.33')
 
     def test_specific_version_full(self):
@@ -360,16 +361,16 @@
         run_emsdk('install 1b7f7bc6002a3ca73647f41fc10e1fac7f06f804')
 
         # Check that its not re-downloaded
-        checked_call_with_output(emsdk + ' install 1b7f7bc6002a3ca73647f41fc10e1fac7f06f804', expected='Skipped', unexpected='Downloading:')
+        checked_call_with_output(f'{emsdk} install 1b7f7bc6002a3ca73647f41fc10e1fac7f06f804', expected='Skipped', unexpected='Downloading:')
 
     def test_install_tool(self):
         # Test that its possible to install emscripten as tool instead of SDK
-        checked_call_with_output(emsdk + ' install releases-77b065ace39e6ab21446e13f92897f956c80476a', unexpected='Installing SDK')
+        checked_call_with_output(f'{emsdk} install releases-77b065ace39e6ab21446e13f92897f956c80476a', unexpected='Installing SDK')
 
     def test_activate_missing(self):
         run_emsdk('install latest')
         expected = "error: tool is not installed and therefore cannot be activated: 'releases-13e29bd55185e3c12802bc090b4507901856b2ba-64bit'"
-        failing_call_with_output(emsdk + ' activate 2.0.1', expected=expected)
+        failing_call_with_output(f'{emsdk} activate 2.0.1', expected=expected)
 
     def test_keep_downloads(self):
         env = os.environ.copy()
@@ -378,9 +379,9 @@
         # install of 2.0.28, and again when we install 2.0.29, but not on the
         # second install of 2.0.28 because the zip should already be local.
         shutil.rmtree('downloads')
-        checked_call_with_output(emsdk + ' install 3.1.54', expected='Downloading:', env=env)
-        checked_call_with_output(emsdk + ' install 3.1.55', expected='Downloading:', env=env)
-        checked_call_with_output(emsdk + ' install 3.1.54', expected='already downloaded, skipping', unexpected='Downloading:', env=env)
+        checked_call_with_output(f'{emsdk} install 3.1.54', expected='Downloading:', env=env)
+        checked_call_with_output(f'{emsdk} install 3.1.55', expected='Downloading:', env=env)
+        checked_call_with_output(f'{emsdk} install 3.1.54', expected='already downloaded, skipping', unexpected='Downloading:', env=env)
 
     def test_unicode_path(self):
         temp_dir = tempfile.mkdtemp(prefix='test_työpöytä_')