aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-07-04 17:51:42 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2021-07-05 17:55:04 +0300
commitdd31891c1fd6d3b9c955e73bd80170242b6423e5 (patch)
treeb6bfd47a74e3ac4f71904afe2ba1996453ce221b /mesonbuild/compilers
parent566efba216b865bff670901aed98d34f09f8d930 (diff)
downloadmeson-dd31891c1fd6d3b9c955e73bd80170242b6423e5.zip
meson-dd31891c1fd6d3b9c955e73bd80170242b6423e5.tar.gz
meson-dd31891c1fd6d3b9c955e73bd80170242b6423e5.tar.bz2
more f-strings too complex to be caught by pyupgrade
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/cpp.py7
-rw-r--r--mesonbuild/compilers/detect.py12
-rw-r--r--mesonbuild/compilers/fortran.py5
-rw-r--r--mesonbuild/compilers/mixins/gnu.py2
-rw-r--r--mesonbuild/compilers/mixins/islinker.py4
5 files changed, 14 insertions, 16 deletions
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index c267c0f..44155d1 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -110,12 +110,11 @@ class CPPCompiler(CLikeCompiler, Compiler):
# Check if it's a class or a template
if extra_args is None:
extra_args = []
- fargs = {'prefix': prefix, 'header': hname, 'symbol': symbol}
- t = '''{prefix}
- #include <{header}>
+ t = f'''{prefix}
+ #include <{hname}>
using {symbol};
int main(void) {{ return 0; }}'''
- return self.compiles(t.format(**fargs), env, extra_args=extra_args,
+ return self.compiles(t, env, extra_args=extra_args,
dependencies=dependencies)
def _test_cpp_std_arg(self, cpp_std_value: str) -> bool:
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index a86366a..78a4be8 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -548,15 +548,15 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
if version != 'unknown version':
break
else:
- m = 'Failed to detect MSVC compiler version: stderr was\n{!r}'
- raise EnvironmentException(m.format(err))
+ m = f'Failed to detect MSVC compiler version: stderr was\n{err!r}'
+ raise EnvironmentException(m)
cl_signature = lookat.split('\n')[0]
match = re.search(r'.*(x86|x64|ARM|ARM64)([^_A-Za-z0-9]|$)', cl_signature)
if match:
target = match.group(1)
else:
- m = 'Failed to detect MSVC compiler target architecture: \'cl /?\' output is\n{}'
- raise EnvironmentException(m.format(cl_signature))
+ m = f'Failed to detect MSVC compiler target architecture: \'cl /?\' output is\n{cl_signature}'
+ raise EnvironmentException(m)
cls = VisualStudioCCompiler if lang == 'c' else VisualStudioCPPCompiler
linker = guess_win_linker(env, ['link'], cls, for_machine)
return cls(
@@ -1049,8 +1049,8 @@ def detect_d_compiler(env: 'Environment', for_machine: MachineChoice) -> Compile
# up to date language version at time (2016).
if os.path.basename(exelist[-1]).startswith(('ldmd', 'gdmd')):
raise EnvironmentException(
- 'Meson does not support {} as it is only a DMD frontend for another compiler.'
- 'Please provide a valid value for DC or unset it so that Meson can resolve the compiler by itself.'.format(exelist[-1]))
+ f'Meson does not support {exelist[-1]} as it is only a DMD frontend for another compiler.'
+ 'Please provide a valid value for DC or unset it so that Meson can resolve the compiler by itself.')
try:
p, out = Popen_safe(exelist + ['--version'])[0:2]
except OSError as e:
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index 925eff6..ba79fe1 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -222,9 +222,8 @@ class GnuFortranCompiler(GnuCompiler, FortranCompiler):
__has_include which breaks with GCC-Fortran 10:
https://github.com/mesonbuild/meson/issues/7017
'''
- fargs = {'prefix': prefix, 'header': hname}
- code = '{prefix}\n#include <{header}>'
- return self.compiles(code.format(**fargs), env, extra_args=extra_args,
+ code = f'{prefix}\n#include <{hname}>'
+ return self.compiles(code, env, extra_args=extra_args,
dependencies=dependencies, mode='preprocess', disable_cache=disable_cache)
diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py
index 9a94703..a4e73d2 100644
--- a/mesonbuild/compilers/mixins/gnu.py
+++ b/mesonbuild/compilers/mixins/gnu.py
@@ -317,7 +317,7 @@ class GnuLikeCompiler(Compiler, metaclass=abc.ABCMeta):
if linker not in {'gold', 'bfd', 'lld'}:
raise mesonlib.MesonException(
'Unsupported linker, only bfd, gold, and lld are supported, '
- 'not {}.'.format(linker))
+ f'not {linker}.')
return [f'-fuse-ld={linker}']
def get_coverage_args(self) -> T.List[str]:
diff --git a/mesonbuild/compilers/mixins/islinker.py b/mesonbuild/compilers/mixins/islinker.py
index eb271f6..33f74e3 100644
--- a/mesonbuild/compilers/mixins/islinker.py
+++ b/mesonbuild/compilers/mixins/islinker.py
@@ -90,8 +90,8 @@ class BasicLinkerIsCompilerMixin(Compiler):
f'Linker {self.id} does not support allow undefined')
def get_pie_link_args(self) -> T.List[str]:
- m = 'Linker {} does not support position-independent executable'
- raise mesonlib.EnvironmentException(m.format(self.id))
+ m = f'Linker {self.id} does not support position-independent executable'
+ raise mesonlib.EnvironmentException(m)
def get_undefined_link_args(self) -> T.List[str]:
return []