diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-10-28 23:01:31 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-11-01 20:26:18 -0400 |
commit | 038b31e72bc02f0a9bdc6d8613992a5c344e8650 (patch) | |
tree | f24c7216b2b2934b1d1c7a87cc6727d5a193bcf0 /mesonbuild/modules | |
parent | bae0fdf64ac697b264bdb5eb93dcb160b3e7f6b2 (diff) | |
download | meson-038b31e72bc02f0a9bdc6d8613992a5c344e8650.zip meson-038b31e72bc02f0a9bdc6d8613992a5c344e8650.tar.gz meson-038b31e72bc02f0a9bdc6d8613992a5c344e8650.tar.bz2 |
various manual conversion of percent-formatted strings to f-strings
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r-- | mesonbuild/modules/gnome.py | 20 | ||||
-rw-r--r-- | mesonbuild/modules/hotdoc.py | 13 | ||||
-rw-r--r-- | mesonbuild/modules/pkgconfig.py | 10 |
3 files changed, 21 insertions, 22 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index ddde779..85bac5c 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -386,10 +386,10 @@ class GnomeModule(ExtensionModule): ".", resfile) except MesonException: raise MesonException( - 'Resource "%s" listed in "%s" was not found. If this is a ' - 'generated file, pass the target that generates it to ' - 'gnome.compile_resources() using the "dependencies" ' - 'keyword argument.' % (resfile, input_file)) + f'Resource "{resfile}" listed in "{input_file}" was not found. ' + 'If this is a generated file, pass the target that generates ' + 'it to gnome.compile_resources() using the "dependencies" ' + 'keyword argument.') raw_dep_files.remove(resfile) dep_files.append(f) dep_files.extend(raw_dep_files) @@ -476,14 +476,14 @@ class GnomeModule(ExtensionModule): # For PkgConfigDependency only: getattr(dep, 'is_libtool', False)): lib_dir = os.path.dirname(flag) - external_ldflags.update(["-L%s" % lib_dir]) + external_ldflags.update([f'-L{lib_dir}']) if include_rpath: external_ldflags.update([f'-Wl,-rpath {lib_dir}']) libname = os.path.basename(flag) if libname.startswith("lib"): libname = libname[3:] libname = libname.split(".so")[0] - flag = "-l%s" % libname + flag = f"-l{libname}" # FIXME: Hack to avoid passing some compiler options in if flag.startswith("-W"): continue @@ -608,7 +608,7 @@ class GnomeModule(ExtensionModule): if 'symbol_prefix' in kwargs: sym_prefixes = mesonlib.stringlistify(kwargs.pop('symbol_prefix', [])) - ret += ['--symbol-prefix=%s' % sym_prefix for sym_prefix in sym_prefixes] + ret += [f'--symbol-prefix={sym_prefix}' for sym_prefix in sym_prefixes] return ret @@ -619,7 +619,7 @@ class GnomeModule(ExtensionModule): identifier_prefix = kwargs.pop('identifier_prefix') if not isinstance(identifier_prefix, str): raise MesonException('Gir identifier prefix must be str') - ret += ['--identifier-prefix=%s' % identifier_prefix] + ret += [f'--identifier-prefix={identifier_prefix}'] return ret @@ -629,9 +629,9 @@ class GnomeModule(ExtensionModule): if 'export_packages' in kwargs: pkgs = kwargs.pop('export_packages') if isinstance(pkgs, str): - ret += ['--pkg-export=%s' % pkgs] + ret += [f'--pkg-export={pkgs}'] elif isinstance(pkgs, list): - ret += ['--pkg-export=%s' % pkg for pkg in pkgs] + ret += [f'--pkg-export={pkg}' for pkg in pkgs] else: raise MesonException('Gir export packages must be str or list') diff --git a/mesonbuild/modules/hotdoc.py b/mesonbuild/modules/hotdoc.py index 9a41aa5..1b89d50 100644 --- a/mesonbuild/modules/hotdoc.py +++ b/mesonbuild/modules/hotdoc.py @@ -135,12 +135,11 @@ class HotdocTargetBuilder: if force_list and not isinstance(value, list): return [value], uvalue return value, uvalue - raise MesonException("%s field value %s is not valid," - " valid types are %s" % (argname, value, - types)) + raise MesonException(f"{argname} field value {value} is not valid," + f" valid types are {types}") except KeyError: if mandatory: - raise MesonException("%s mandatory field not found" % argname) + raise MesonException(f"{argname} mandatory field not found") if default is not None: return default, default @@ -279,14 +278,14 @@ class HotdocTargetBuilder: _dir = os.path.join(self.sourcedir, self.subdir, value) if not os.path.isdir(_dir): - raise InvalidArguments('"%s" is not a directory.' % _dir) + raise InvalidArguments(f'"{_dir}" is not a directory.') return os.path.relpath(_dir, os.path.join(self.builddir, self.subdir)) def check_forbidden_args(self): for arg in ['conf_file']: if arg in self.kwargs: - raise InvalidArguments('Argument "%s" is forbidden.' % arg) + raise InvalidArguments(f'Argument "{arg}" is forbidden.') def add_include_path(self, path): self.include_paths[path] = path @@ -414,7 +413,7 @@ class HotDocModule(ExtensionModule): @noKwargs def has_extensions(self, state, args, kwargs): - return self.hotdoc.run_hotdoc(['--has-extension=%s' % extension for extension in args]) == 0 + return self.hotdoc.run_hotdoc([f'--has-extension={extension}' for extension in args]) == 0 def generate_doc(self, state, args, kwargs): if len(args) != 1: diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py index 80d0c51..4a0b39e 100644 --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -355,12 +355,12 @@ class PkgConfigModule(ExtensionModule): for k, v in unescaped_variables: ofile.write(f'{k}={v}\n') ofile.write('\n') - ofile.write('Name: %s\n' % name) + ofile.write(f'Name: {name}\n') if len(description) > 0: - ofile.write('Description: %s\n' % description) + ofile.write(f'Description: {description}\n') if len(url) > 0: - ofile.write('URL: %s\n' % url) - ofile.write('Version: %s\n' % version) + ofile.write(f'URL: {url}\n') + ofile.write(f'Version: {version}\n') reqs_str = deps.format_reqs(deps.pub_reqs) if len(reqs_str) > 0: ofile.write(f'Requires: {reqs_str}\n') @@ -406,7 +406,7 @@ class PkgConfigModule(ExtensionModule): if not is_custom_target and l.name_suffix_set: mlog.warning(msg.format(l.name, 'name_suffix', lname, pcfile)) if is_custom_target or 'cs' not in l.compilers: - yield '-l%s' % lname + yield f'-l{lname}' def get_uninstalled_include_dirs(libs): result = [] |