aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/cmake.py2
-rw-r--r--mesonbuild/modules/gnome.py40
-rw-r--r--mesonbuild/modules/hotdoc.py3
-rw-r--r--mesonbuild/modules/i18n.py2
-rw-r--r--mesonbuild/modules/pkgconfig.py3
-rw-r--r--mesonbuild/modules/python.py6
-rw-r--r--mesonbuild/modules/unstable_cuda.py3
7 files changed, 26 insertions, 33 deletions
diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py
index 94f90fa..51ee9ee 100644
--- a/mesonbuild/modules/cmake.py
+++ b/mesonbuild/modules/cmake.py
@@ -307,7 +307,7 @@ class CmakeModule(ExtensionModule):
with open(infile, encoding='utf-8') as fin:
data = fin.readlines()
except Exception as e:
- raise mesonlib.MesonException('Could not read input file {}: {}'.format(infile, str(e)))
+ raise mesonlib.MesonException(f'Could not read input file {infile}: {e!s}')
result = []
regex = re.compile(r'(?:\\\\)+(?=\\?@)|\\@|@([-a-zA-Z0-9_]+)@')
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 81551ca..a6c0e1b 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -205,10 +205,10 @@ class GnomeModule(ExtensionModule):
'<https://bugzilla.gnome.org/show_bug.cgi?id=774368>'
raise MesonException(m)
else:
- m = 'Unexpected dependency type {!r} for gnome.compile_resources() ' \
+ m = f'Unexpected dependency type {dep!r} for gnome.compile_resources() ' \
'"dependencies" argument.\nPlease pass the return value of ' \
'custom_target() or configure_file()'
- raise MesonException(m.format(dep))
+ raise MesonException(m)
if not mesonlib.version_compare(glib_version, gresource_dep_needed_version):
ifile = args[1]
@@ -327,8 +327,8 @@ class GnomeModule(ExtensionModule):
except (FileNotFoundError, PermissionError):
raise MesonException('Could not execute glib-compile-resources.')
if pc.returncode != 0:
- m = 'glib-compile-resources failed to get dependencies for {}:\n{}'
- mlog.warning(m.format(cmd[1], stderr))
+ m = f'glib-compile-resources failed to get dependencies for {cmd[1]}:\n{stderr}'
+ mlog.warning(m)
raise subprocess.CalledProcessError(pc.returncode, cmd)
dep_files = stdout.split('\n')[:-1]
@@ -1224,8 +1224,8 @@ class GnomeModule(ExtensionModule):
if not mesonlib.version_compare(glib_version, '>= 2.49.1'):
# Warn if requested, silently disable if not
if 'autocleanup' in kwargs:
- mlog.warning('Glib version ({}) is too old to support the \'autocleanup\' '
- 'kwarg, need 2.49.1 or newer'.format(glib_version))
+ mlog.warning(f'Glib version ({glib_version}) is too old to support the \'autocleanup\' '
+ 'kwarg, need 2.49.1 or newer')
return []
autocleanup = kwargs.pop('autocleanup', 'all')
values = ('none', 'objects', 'all')
@@ -1518,7 +1518,7 @@ class GnomeModule(ExtensionModule):
fhead += '%s\n' % body_prefix
fhead += '#include "%s"\n' % hdr_filename
for hdr in sources:
- fhead += '#include "%s"\n' % os.path.basename(str(hdr))
+ fhead += '#include "{}"\n'.format(os.path.basename(str(hdr)))
fhead += '''
#define C_ENUM(v) ((gint) v)
#define C_FLAGS(v) ((guint) v)
@@ -1529,12 +1529,12 @@ class GnomeModule(ExtensionModule):
/* enumerations from "@basename@" */
'''
- c_file_kwargs['vhead'] = '''
+ c_file_kwargs['vhead'] = f'''
GType
-%s@enum_name@_get_type (void)
-{
+{func_prefix}@enum_name@_get_type (void)
+{{
static gsize gtype_id = 0;
- static const G@Type@Value values[] = {''' % func_prefix
+ static const G@Type@Value values[] = {{'''
c_file_kwargs['vprod'] = ' { C_@TYPE@(@VALUENAME@), "@VALUENAME@", "@valuenick@" },'
@@ -1553,22 +1553,22 @@ GType
# .h file generation
h_file_kwargs = copy.deepcopy(mkenums_kwargs)
- h_file_kwargs['fhead'] = '''#pragma once
+ h_file_kwargs['fhead'] = f'''#pragma once
#include <glib-object.h>
-{}
+{header_prefix}
G_BEGIN_DECLS
-'''.format(header_prefix)
+'''
h_file_kwargs['fprod'] = '''
/* enumerations from "@basename@" */
'''
- h_file_kwargs['vhead'] = '''
-{}
-GType {}@enum_name@_get_type (void);
-#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ ({}@enum_name@_get_type())'''.format(decl_decorator, func_prefix, func_prefix)
+ h_file_kwargs['vhead'] = f'''
+{decl_decorator}
+GType {func_prefix}@enum_name@_get_type (void);
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ ({func_prefix}@enum_name@_get_type())'''
h_file_kwargs['ftail'] = '''
G_END_DECLS'''
@@ -1630,9 +1630,7 @@ G_END_DECLS'''
elif arg in known_kwargs and value:
cmd += ['--' + arg.replace('_', '-')]
elif arg not in known_custom_target_kwargs:
- raise MesonException(
- 'Genmarshal does not take a {} keyword argument.'.format(
- arg))
+ raise MesonException(f'Genmarshal does not take a {arg} keyword argument.')
install_header = kwargs.pop('install_header', False)
install_dir = kwargs.pop('install_dir', None)
diff --git a/mesonbuild/modules/hotdoc.py b/mesonbuild/modules/hotdoc.py
index 609b8da..9a41aa5 100644
--- a/mesonbuild/modules/hotdoc.py
+++ b/mesonbuild/modules/hotdoc.py
@@ -406,8 +406,7 @@ class HotDocModule(ExtensionModule):
from hotdoc.run_hotdoc import run # noqa: F401
self.hotdoc.run_hotdoc = run
except Exception as e:
- raise MesonException('hotdoc {} required but not found. ({})'.format(
- MIN_HOTDOC_VERSION, e))
+ raise MesonException(f'hotdoc {MIN_HOTDOC_VERSION} required but not found. ({e})')
self.methods.update({
'has_extensions': self.has_extensions,
'generate_doc': self.generate_doc,
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py
index 1457874..7c6f0f4 100644
--- a/mesonbuild/modules/i18n.py
+++ b/mesonbuild/modules/i18n.py
@@ -230,7 +230,7 @@ class I18nModule(ExtensionModule):
lang_arg = '--langs=' + '@@'.join(languages) if languages else None
_datadirs = ':'.join(self._get_data_dirs(state, kwargs['data_dirs']))
- datadirs = '--datadirs={}'.format(_datadirs) if _datadirs else None
+ datadirs = f'--datadirs={_datadirs}' if _datadirs else None
extra_args = kwargs['args']
targets: T.List['Target'] = []
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index c9bec4a..e865110 100644
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -100,8 +100,7 @@ class DependenciesHelper:
else:
raise mesonlib.MesonException('requires argument not a string, '
'library with pkgconfig-generated file '
- 'or pkgconfig-dependency object, '
- 'got {!r}'.format(obj))
+ 'or pkgconfig-dependency object, got {obj!r}')
return processed_reqs
def add_cflags(self, cflags):
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index 2d5eaea..1f948cf 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -141,8 +141,7 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
elif pycc.startswith(('i686', 'i386')):
return '32'
else:
- mlog.log('MinGW Python built with unknown CC {!r}, please file'
- 'a bug'.format(pycc))
+ mlog.log(f'MinGW Python built with unknown CC {pycc!r}, please file a bug')
return None
elif self.platform == 'win32':
return '32'
@@ -199,8 +198,7 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
return
# Pyarch ends in '32' or '64'
if arch != pyarch:
- mlog.log('Need', mlog.bold(self.name), 'for {}-bit, but '
- 'found {}-bit'.format(arch, pyarch))
+ mlog.log('Need', mlog.bold(self.name), f'for {arch}-bit, but found {pyarch}-bit')
self.is_found = False
return
# This can fail if the library is not found
diff --git a/mesonbuild/modules/unstable_cuda.py b/mesonbuild/modules/unstable_cuda.py
index 63c7f85..e3997f5 100644
--- a/mesonbuild/modules/unstable_cuda.py
+++ b/mesonbuild/modules/unstable_cuda.py
@@ -294,8 +294,7 @@ class CudaModule(NewExtensionModule):
}.get(arch_name, (None, None))
if arch_bin is None:
- raise InvalidArguments('Unknown CUDA Architecture Name {}!'
- .format(arch_name))
+ raise InvalidArguments(f'Unknown CUDA Architecture Name {arch_name}!')
cuda_arch_bin += arch_bin