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 /test cases/common | |
parent | 4340bf34faca7eed8076ba4c388fbe15355f2183 (diff) | |
download | meson-6a0fabc6472f49621260de215f128a31ae70219b.zip meson-6a0fabc6472f49621260de215f128a31ae70219b.tar.gz meson-6a0fabc6472f49621260de215f128a31ae70219b.tar.bz2 |
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
Diffstat (limited to 'test cases/common')
9 files changed, 17 insertions, 17 deletions
diff --git a/test cases/common/106 generatorcustom/gen-resx.py b/test cases/common/106 generatorcustom/gen-resx.py index 7d31ade..242a962 100755 --- a/test cases/common/106 generatorcustom/gen-resx.py +++ b/test cases/common/106 generatorcustom/gen-resx.py @@ -6,4 +6,4 @@ ofile = sys.argv[1] num = sys.argv[2] with open(ofile, 'w') as f: - f.write('res{}\n'.format(num)) + f.write(f'res{num}\n') diff --git a/test cases/common/14 configure file/check_file.py b/test cases/common/14 configure file/check_file.py index 707995e..1cdb624 100644 --- a/test cases/common/14 configure file/check_file.py +++ b/test cases/common/14 configure file/check_file.py @@ -12,9 +12,9 @@ elif len(sys.argv) == 3: m2 = os.stat(f2).st_mtime_ns # Compare only os.stat() if m1 != m2: - raise RuntimeError('mtime of {!r} () != mtime of {!r} ()'.format(f1, m1, f2, m2)) + raise RuntimeError(f'mtime of {f1!r} () != mtime of {m1!r} ()') import filecmp if not filecmp.cmp(f1, f2): - raise RuntimeError('{!r} != {!r}'.format(f1, f2)) + raise RuntimeError(f'{f1!r} != {f2!r}') else: raise AssertionError diff --git a/test cases/common/14 configure file/generator-deps.py b/test cases/common/14 configure file/generator-deps.py index 376ddb2..cca253c 100755 --- a/test cases/common/14 configure file/generator-deps.py +++ b/test cases/common/14 configure file/generator-deps.py @@ -16,4 +16,4 @@ with outputf.open('w') as ofile: depf = Path(sys.argv[2]) if not depf.exists(): with depf.open('w') as ofile: - ofile.write("{}: depfile\n".format(outputf.name)) + ofile.write(f"{outputf.name}: depfile\n") diff --git a/test cases/common/140 mesonintrospect from scripts/check_env.py b/test cases/common/140 mesonintrospect from scripts/check_env.py index 2d46d88..61de546 100644 --- a/test cases/common/140 mesonintrospect from scripts/check_env.py +++ b/test cases/common/140 mesonintrospect from scripts/check_env.py @@ -22,7 +22,7 @@ introspect_arr = shlex.split(mesonintrospect) some_executable = introspect_arr[0] if not os.path.isfile(some_executable): - raise RuntimeError('{!r} does not exist'.format(mesonintrospect)) + raise RuntimeError(f'{mesonintrospect!r} does not exist') if do_print: print(some_executable, end='') diff --git a/test cases/common/169 preserve gendir/genprog.py b/test cases/common/169 preserve gendir/genprog.py index a50642b..681c43a 100755 --- a/test cases/common/169 preserve gendir/genprog.py +++ b/test cases/common/169 preserve gendir/genprog.py @@ -29,7 +29,7 @@ rel_ofiles = [] for ifile in ifiles: if not ifile.startswith(options.searchdir): - sys.exit('Input file %s does not start with search dir %s.' % (ifile, searchdir)) + sys.exit(f'Input file {ifile} does not start with search dir {searchdir}.') rel_ofile = ifile[len(searchdir):] if rel_ofile[0] == '/' or rel_ofile[0] == '\\': rel_ofile = rel_ofile[1:] diff --git a/test cases/common/196 generator in subdir/com/mesonbuild/genprog.py b/test cases/common/196 generator in subdir/com/mesonbuild/genprog.py index a50642b..681c43a 100644 --- a/test cases/common/196 generator in subdir/com/mesonbuild/genprog.py +++ b/test cases/common/196 generator in subdir/com/mesonbuild/genprog.py @@ -29,7 +29,7 @@ rel_ofiles = [] for ifile in ifiles: if not ifile.startswith(options.searchdir): - sys.exit('Input file %s does not start with search dir %s.' % (ifile, searchdir)) + sys.exit(f'Input file {ifile} does not start with search dir {searchdir}.') rel_ofile = ifile[len(searchdir):] if rel_ofile[0] == '/' or rel_ofile[0] == '\\': rel_ofile = rel_ofile[1:] diff --git a/test cases/common/227 link depends indexed custom target/check_arch.py b/test cases/common/227 link depends indexed custom target/check_arch.py index 2e09f35..927bf87 100644 --- a/test cases/common/227 link depends indexed custom target/check_arch.py +++ b/test cases/common/227 link depends indexed custom target/check_arch.py @@ -29,4 +29,4 @@ elif arch == 'x64': arch = 'x86_64' if arch != want_arch: - raise RuntimeError('Wanted arch {} but exe uses {}'.format(want_arch, arch)) + raise RuntimeError(f'Wanted arch {want_arch} but exe uses {arch}') diff --git a/test cases/common/50 custom target/depfile/dep.py b/test cases/common/50 custom target/depfile/dep.py index dc6e6b6..c9e8f94 100755 --- a/test cases/common/50 custom target/depfile/dep.py +++ b/test cases/common/50 custom target/depfile/dep.py @@ -12,4 +12,4 @@ quoted_depfiles = [x.replace(' ', r'\ ') for x in depfiles] with open(output, 'w') as f: f.write('I am the result of globbing.') with open(depfile, 'w') as f: - f.write('%s: %s\n' % (output, ' '.join(quoted_depfiles))) + f.write('{}: {}\n'.format(output, ' '.join(quoted_depfiles))) diff --git a/test cases/common/96 manygen/subdir/manygen.py b/test cases/common/96 manygen/subdir/manygen.py index c40cc2e..931fb61 100755 --- a/test cases/common/96 manygen/subdir/manygen.py +++ b/test cases/common/96 manygen/subdir/manygen.py @@ -41,18 +41,18 @@ tmpc = 'diibadaaba.c' tmpo = 'diibadaaba' + objsuffix with open(outc, 'w') as f: - f.write('''#include"%s.h" -int %s_in_src(void) { + f.write('''#include"{}.h" +int {}_in_src(void) {{ return 0; -} -''' % (funcname, funcname)) +}} +'''.format(funcname, funcname)) with open(outh, 'w') as f: f.write('''#pragma once -int %s_in_lib(void); -int %s_in_obj(void); -int %s_in_src(void); -''' % (funcname, funcname, funcname)) +int {}_in_lib(void); +int {}_in_obj(void); +int {}_in_src(void); +'''.format(funcname, funcname, funcname)) with open(tmpc, 'w') as f: f.write('''int %s_in_obj(void) { |