diff options
| author | Eli Schwartz <eschwartz@archlinux.org> | 2021-03-04 17:16:11 -0500 |
|---|---|---|
| committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-03-04 17:16:11 -0500 |
| commit | 6a0fabc6472f49621260de215f128a31ae70219b (patch) | |
| tree | 6a67908358a2c5e5baa215fe0201dfe213dd8a01 /mesonbuild/compilers/mixins/clike.py | |
| parent | 4340bf34faca7eed8076ba4c388fbe15355f2183 (diff) | |
| download | meson-6a0fabc6472f49621260de215f128a31ae70219b.tar.gz | |
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
Diffstat (limited to 'mesonbuild/compilers/mixins/clike.py')
| -rw-r--r-- | mesonbuild/compilers/mixins/clike.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index ad0e257d3..787c2c124 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -118,7 +118,7 @@ class CLikeCompilerArgs(arglist.CompilerArgs): def __repr__(self) -> str: self.flush_pre_post() - return 'CLikeCompilerArgs({!r}, {!r})'.format(self.compiler, self._container) + return f'CLikeCompilerArgs({self.compiler!r}, {self._container!r})' class CLikeCompiler(Compiler): @@ -321,7 +321,7 @@ class CLikeCompiler(Compiler): mlog.debug(stde) mlog.debug('-----') if pc.returncode != 0: - raise mesonlib.EnvironmentException('Compiler {} can not compile programs.'.format(self.name_string())) + raise mesonlib.EnvironmentException(f'Compiler {self.name_string()} can not compile programs.') # Run sanity check if self.is_cross: if self.exe_wrapper is None: @@ -337,7 +337,7 @@ class CLikeCompiler(Compiler): raise mesonlib.EnvironmentException('Could not invoke sanity test executable: %s.' % str(e)) pe.wait() if pe.returncode != 0: - raise mesonlib.EnvironmentException('Executables created by {} compiler {} are not runnable.'.format(self.language, self.name_string())) + raise mesonlib.EnvironmentException(f'Executables created by {self.language} compiler {self.name_string()} are not runnable.') def sanity_check(self, work_dir: str, environment: 'Environment') -> None: code = 'int main(void) { int class=0; return class; }\n' @@ -485,7 +485,7 @@ class CLikeCompiler(Compiler): try: pe, so, se = mesonlib.Popen_safe(cmdlist) except Exception as e: - mlog.debug('Could not run: %s (error: %s)\n' % (cmdlist, e)) + mlog.debug(f'Could not run: {cmdlist} (error: {e})\n') return compilers.RunResult(False) mlog.debug('Program stdout:\n') @@ -692,7 +692,7 @@ class CLikeCompiler(Compiler): with func() as p: cached = p.cached if p.returncode != 0: - raise mesonlib.EnvironmentException('Could not get define {!r}'.format(dname)) + raise mesonlib.EnvironmentException(f'Could not get define {dname!r}') # Get the preprocessed value after the delimiter, # minus the extra newline at the end and # merge string literals. @@ -710,7 +710,7 @@ class CLikeCompiler(Compiler): fmt = '%lli' cast = '(long long int)' else: - raise AssertionError('BUG: Unknown return type {!r}'.format(rtype)) + raise AssertionError(f'BUG: Unknown return type {rtype!r}') fargs = {'prefix': prefix, 'f': fname, 'cast': cast, 'fmt': fmt} code = '''{prefix} #include <stdio.h> @@ -810,7 +810,7 @@ class CLikeCompiler(Compiler): if val is not None: if isinstance(val, bool): return val, False - raise mesonlib.EnvironmentException('Cross variable {} is not a boolean.'.format(varname)) + raise mesonlib.EnvironmentException(f'Cross variable {varname} is not a boolean.') # TODO: we really need a protocol for this, # @@ -951,7 +951,7 @@ class CLikeCompiler(Compiler): elif symbol_name in line: mlog.debug("Symbols have underscore prefix: NO") return False - raise RuntimeError('BUG: {!r} check failed unexpectedly'.format(n)) + raise RuntimeError(f'BUG: {n!r} check failed unexpectedly') def _get_patterns(self, env: 'Environment', prefixes: T.List[str], suffixes: T.List[str], shared: bool = False) -> T.List[str]: patterns = [] # type: T.List[str] |
