55import os .path
66import re
77import shlex
8+ import shutil
89import warnings
9- from distutils .spawn import find_executable
1010from stat import ST_MODE
1111
1212from SCons .Script import BUILD_TARGETS , Dir , File , Glob , SConscript
@@ -247,12 +247,12 @@ def finish(defaultTargets=DEFAULT_TARGETS, subDirList=None, ignoreRegex=None):
247247 checkTestStatus_command = state .env .Command (
248248 "checkTestStatus" ,
249249 [],
250- """
251- @ if [ -d {0 } ]; then \
252- nfail=`find {0 } -name "*.failed" | wc -l | sed -e 's/ //g'`; \
250+ f """
251+ @ if [ -d { testsDir } ]; then \
252+ nfail=`find { testsDir } -name "*.failed" | wc -l | sed -e 's/ //g'`; \
253253 if [ $$nfail -gt 0 ]; then \
254254 echo "Failed test output:" >&2; \
255- for f in `find {0 } -name "*.failed"`; do \
255+ for f in `find { testsDir } -name "*.failed"`; do \
256256 case "$$f" in \
257257 *.xml.failed) \
258258 echo "Global pytest output is in $$f" >&2; \
@@ -263,13 +263,11 @@ def finish(defaultTargets=DEFAULT_TARGETS, subDirList=None, ignoreRegex=None):
263263 esac; \
264264 done; \
265265 echo "The following tests failed:" >&2;\
266- find {0 } -name "*.failed" >&2; \
266+ find { testsDir } -name "*.failed" >&2; \
267267 echo "$$nfail tests failed" >&2; exit 1; \
268268 fi; \
269269 fi; \
270- """ .format (
271- testsDir
272- ),
270+ """ ,
273271 )
274272
275273 state .env .Depends (checkTestStatus_command , BUILD_TARGETS ) # this is why the check runs last
@@ -372,8 +370,8 @@ def rewrite_shebang(target, source, env):
372370 else :
373371 if not match :
374372 state .log .warn (
375- "Could not rewrite shebang of {}. Please check"
376- " file or move it to bin directory." . format ( str ( src ))
373+ f "Could not rewrite shebang of { src } . Please check"
374+ " file or move it to bin directory."
377375 )
378376 outfd .write (first_line )
379377 for line in srcfd .readlines ():
@@ -534,7 +532,7 @@ def doc(config="doxygen.conf.in", projectName=None, projectNumber=None, **kwargs
534532 result : ???
535533 ???
536534 """
537- if not find_executable ("doxygen" ):
535+ if not shutil . which ("doxygen" ):
538536 state .log .warn ("doxygen executable not found; skipping documentation build." )
539537 return []
540538 if projectName is None :
@@ -677,8 +675,7 @@ def s(ll):
677675 for node in pySingles :
678676 if str (node ).startswith ("test_" ):
679677 state .log .warn (
680- "Warning: {} should be run independently but"
681- " can be automatically discovered" .format (node )
678+ f"Warning: { node } should be run independently but can be automatically discovered"
682679 )
683680
684681 # Ensure that python tests listed in pySingles are not included in
0 commit comments