Skip to content

Commit 6fb7279

Browse files
committed
Convert a large %-format to f-string
This allows the variables to be inlined in the large string.
1 parent 502d8d8 commit 6fb7279

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

python/lsst/sconsUtils/tests.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -281,28 +281,18 @@ def run(self, fileGlob):
281281
result = self._env.Command(
282282
target,
283283
f,
284-
"""
285-
@rm -f ${TARGET}.failed;
286-
@printf "%%s" 'running ${SOURCES}... ';
287-
@echo $SOURCES %s > $TARGET; echo >> $TARGET;
288-
@if %s %s $SOURCES %s >> $TARGET 2>&1; then \
289-
if ! %s; then mv $TARGET ${TARGET}.failed; fi; \
290-
echo "%s"; \
284+
f"""
285+
@rm -f ${{TARGET}}.failed;
286+
@printf "%s" 'running ${{SOURCES}}... ';
287+
@echo $SOURCES {expandedArgs} > $TARGET; echo >> $TARGET;
288+
@if {libpathstr} {interpreter} $SOURCES {expandedArgs} >> $TARGET 2>&1; then \
289+
if ! {should_pass}; then mv $TARGET ${{TARGET}}.failed; fi; \
290+
echo "{passedMsg}"; \
291291
else \
292-
if ! %s; then mv $TARGET ${TARGET}.failed; fi; \
293-
echo "%s"; \
292+
if ! {should_fail}; then mv $TARGET ${{TARGET}}.failed; fi; \
293+
echo "{failedMsg}"; \
294294
fi;
295-
"""
296-
% (
297-
expandedArgs,
298-
libpathstr,
299-
interpreter,
300-
expandedArgs,
301-
should_pass,
302-
passedMsg,
303-
should_fail,
304-
failedMsg,
305-
),
295+
""",
306296
)
307297

308298
targets.extend(result)

0 commit comments

Comments
 (0)