From: Jan Janssen Date: Tue, 10 Jan 2023 14:13:22 +0000 (+0100) Subject: ukify: Fix tools detection if --tools was not passed X-Git-Tag: v253-rc1~134 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c8add4c2e8e84a176b11a1ff83a2d319d1738304;p=thirdparty%2Fsystemd.git ukify: Fix tools detection if --tools was not passed In 789a642738d28cf2a8ad3f65df9c0c136e83af09 llvm-objcopy was given higher priority over objcopy, but this would only work if --tools was also passed. --- diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index 2827eadbb60..296521aa56e 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -16,6 +16,7 @@ import os import pathlib import re import shlex +import shutil import subprocess import tempfile import typing @@ -341,7 +342,10 @@ def find_tool(name, fallback=None, opts=None): if tool.exists(): return tool - return fallback or name + if shutil.which(name) is not None: + return name + + return fallback def combine_signatures(pcrsigs):