@@ -65,7 +65,7 @@ def from_str(cls, string: str) -> 'TestProtocol':
65
65
return cls .GTEST
66
66
elif string == 'rust' :
67
67
return cls .RUST
68
- raise MesonException ('unknown test format {}' . format ( string ) )
68
+ raise MesonException (f 'unknown test format { string } ' )
69
69
70
70
def __str__ (self ) -> str :
71
71
cls = type (self )
@@ -282,14 +282,14 @@ def get_target_filename_for_linking(self, target):
282
282
return os .path .join (self .get_target_dir (target ), target .get_filename ())
283
283
elif isinstance (target , (build .CustomTarget , build .CustomTargetIndex )):
284
284
if not target .is_linkable_target ():
285
- raise MesonException ('Tried to link against custom target "{}", which is not linkable.' . format ( target . name ) )
285
+ raise MesonException (f 'Tried to link against custom target "{ target . name } ", which is not linkable.' )
286
286
return os .path .join (self .get_target_dir (target ), target .get_filename ())
287
287
elif isinstance (target , build .Executable ):
288
288
if target .import_filename :
289
289
return os .path .join (self .get_target_dir (target ), target .get_import_filename ())
290
290
else :
291
291
return None
292
- raise AssertionError ('BUG: Tried to link to {!r} which is not linkable' . format ( target ) )
292
+ raise AssertionError (f 'BUG: Tried to link to { target !r} which is not linkable' )
293
293
294
294
@lru_cache (maxsize = None )
295
295
def get_target_dir (self , target ):
@@ -335,7 +335,7 @@ def get_target_generated_dir(self, target, gensrc, src):
335
335
def get_unity_source_file (self , target , suffix , number ):
336
336
# There is a potential conflict here, but it is unlikely that
337
337
# anyone both enables unity builds and has a file called foo-unity.cpp.
338
- osrc = '{ }-unity{}.{}' . format ( target . name , number , suffix )
338
+ osrc = f' { target . name } -unity{ number } .{ suffix } '
339
339
return mesonlib .File .from_built_file (self .get_target_private_dir (target ), osrc )
340
340
341
341
def generate_unity_files (self , target , unity_src ):
@@ -368,7 +368,7 @@ def init_language_file(suffix, unity_file_number):
368
368
ofile = init_language_file (comp .get_default_suffix (), unity_file_number )
369
369
unity_file_number += 1
370
370
files_in_current = 0
371
- ofile .write ('#include<{}>\n ' . format ( src ) )
371
+ ofile .write (f '#include<{ src } >\n ' )
372
372
files_in_current += 1
373
373
if ofile :
374
374
ofile .close ()
@@ -505,7 +505,7 @@ def as_meson_exe_cmdline(self, tname, exe, cmd_args, workdir=None,
505
505
data = bytes (str (es .env ) + str (es .cmd_args ) + str (es .workdir ) + str (capture ),
506
506
encoding = 'utf-8' )
507
507
digest = hashlib .sha1 (data ).hexdigest ()
508
- scratch_file = 'meson_exe_{}_{}.dat' . format ( basename , digest )
508
+ scratch_file = f 'meson_exe_{ basename } _{ digest } .dat'
509
509
exe_data = os .path .join (self .environment .get_scratch_dir (), scratch_file )
510
510
with open (exe_data , 'wb' ) as f :
511
511
pickle .dump (es , f )
@@ -575,7 +575,7 @@ def get_external_rpath_dirs(self, target):
575
575
for dir in symbols_match .group (1 ).split (':' ):
576
576
# Prevent usage of --just-symbols to specify rpath
577
577
if Path (dir ).is_dir ():
578
- raise MesonException ('Invalid arg for --just-symbols, {} is a directory.' . format ( dir ) )
578
+ raise MesonException (f 'Invalid arg for --just-symbols, { dir } is a directory.' )
579
579
return dirs
580
580
581
581
def rpaths_for_bundled_shared_libraries (self , target , exclude_system = True ):
@@ -601,7 +601,7 @@ def rpaths_for_bundled_shared_libraries(self, target, exclude_system=True):
601
601
continue
602
602
if libdir .startswith (self .environment .get_source_dir ()):
603
603
rel_to_src = libdir [len (self .environment .get_source_dir ()) + 1 :]
604
- assert not os .path .isabs (rel_to_src ), 'rel_to_src: {} is absolute' . format ( rel_to_src )
604
+ assert not os .path .isabs (rel_to_src ), f 'rel_to_src: { rel_to_src } is absolute'
605
605
paths .append (os .path .join (self .build_to_src , rel_to_src ))
606
606
else :
607
607
paths .append (libdir )
@@ -717,7 +717,7 @@ def get_pch_include_args(self, compiler, target):
717
717
def create_msvc_pch_implementation (self , target , lang , pch_header ):
718
718
# We have to include the language in the file name, otherwise
719
719
# pch.c and pch.cpp will both end up as pch.obj in VS backends.
720
- impl_name = 'meson_pch-{}.{}' . format ( lang , lang )
720
+ impl_name = f 'meson_pch-{ lang } .{ lang } '
721
721
pch_rel_to_build = os .path .join (self .get_target_private_dir (target ), impl_name )
722
722
# Make sure to prepend the build dir, since the working directory is
723
723
# not defined. Otherwise, we might create the file in the wrong path.
@@ -833,7 +833,7 @@ def build_target_link_arguments(self, compiler, deps):
833
833
args = []
834
834
for d in deps :
835
835
if not (d .is_linkable_target ()):
836
- raise RuntimeError ('Tried to link with a non-library target "{}".' . format ( d .get_basename ()) )
836
+ raise RuntimeError (f 'Tried to link with a non-library target "{ d .get_basename ()} ".' )
837
837
arg = self .get_target_filename_for_linking (d )
838
838
if not arg :
839
839
continue
@@ -1011,7 +1011,7 @@ def check_clock_skew(self, file_list):
1011
1011
# to the future by a minuscule amount, less than
1012
1012
# 0.001 seconds. I don't know why.
1013
1013
if delta > 0.001 :
1014
- raise MesonException ('Clock skew detected. File {} has a time stamp {:.4f}s in the future.' . format ( absf , delta ) )
1014
+ raise MesonException (f 'Clock skew detected. File { absf } has a time stamp { delta :.4f} s in the future.' )
1015
1015
1016
1016
def build_target_to_cmd_array (self , bt ):
1017
1017
if isinstance (bt , build .BuildTarget ):
@@ -1036,7 +1036,7 @@ def replace_outputs(self, args, private_dir, output_list):
1036
1036
m = regex .search (arg )
1037
1037
while m is not None :
1038
1038
index = int (m .group (1 ))
1039
- src = '@OUTPUT{}@' . format ( index )
1039
+ src = f '@OUTPUT{ index } @'
1040
1040
arg = arg .replace (src , os .path .join (private_dir , output_list [index ]))
1041
1041
m = regex .search (arg )
1042
1042
newargs .append (arg )
@@ -1239,7 +1239,7 @@ def run_postconf_scripts(self) -> None:
1239
1239
1240
1240
for s in self .build .postconf_scripts :
1241
1241
name = ' ' .join (s .cmd_args )
1242
- mlog .log ('Running postconf script {!r}' . format ( name ) )
1242
+ mlog .log (f 'Running postconf script { name !r} ' )
1243
1243
run_exe (s , env )
1244
1244
1245
1245
def create_install_data (self ) -> InstallData :
0 commit comments