1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-13 13:09:49 +04:00

fbt: reworked tool path handling (#3105)

* fbt: removed absolute paths from env setup; moved abs paths to cdb tool
* fbt: moved tool lookup to cdb emitter
* fbt: cdb: quote only tools with spaces in path
* typo fix
* fbt: pvs: suppress license expiration warning
This commit is contained in:
hedger
2023-09-25 08:04:34 +03:00
committed by GitHub
parent b98631c633
commit e1030e7999
3 changed files with 32 additions and 16 deletions

View File

@@ -2,8 +2,6 @@ import subprocess
import gdb
import objdump
import shutil
import strip
from SCons.Action import _subproc
from SCons.Errors import StopError
@@ -13,20 +11,25 @@ from SCons.Tool import ar, asm, gcc, gnulink, gxx
def prefix_commands(env, command_prefix, cmd_list):
for command in cmd_list:
if command in env:
env[command] = shutil.which(command_prefix + env[command])
prefixed_binary = command_prefix + env[command]
if not env.WhereIs(prefixed_binary):
raise StopError(
f"Toolchain binary {prefixed_binary} not found in PATH."
)
env.Replace(**{command: prefixed_binary})
def _get_tool_version(env, tool):
verstr = "version unknown"
proc = _subproc(
env,
env.subst("${%s} --version" % tool),
[env.subst("${%s}" % tool), "--version"],
stdout=subprocess.PIPE,
stderr="devnull",
stdin="devnull",
universal_newlines=True,
error="raise",
shell=True,
shell=False,
)
if proc:
verstr = proc.stdout.readline()