unleashed-firmware/scripts/fbt_tools/fbt_tweaks.py
hedger 0adad32418
fbt fixes pt4 (#1899)
* fbt: fixed py scripts for gdb
* fbt: removed compiled dolphin assets from tracked files; resolved cached dependency issues by globally disabling deps cache; changed dependency tracking for dolphin assets
* fbt: fix for "resources" node lookup
* toolchain: bump to v.16 with scons + x64 win binaries
* fbt: using scons from toolchain
* vscode: fixed paths for 64-bit Windows toolchain
* fbt: added colors!
* fbt: moved import validator to ansi lib coloring
* fbt: moved COMSTR vars to tools
* fbt: custom action for fap dist
* fbt: added OPENOCD_ADAPTER_SERIAL configuration var for openocd operations
* fbt: added get_stlink target
* docs: details on libs for faps
* vscode: added DAP config for using Flipper as a debugger for a 2nd Flipper
* fbt: blind deps fix for sdk_origin
* fbt: sdk: moved deployment actions to pure python
* Github: disable disableLicenseExpirationCheck option for pvs

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-10-26 07:15:02 +09:00

43 lines
972 B
Python

import SCons.Warnings as Warnings
# from SCons.Script.Main import find_deepest_user_frame
from ansi.color import fg, bg, fx
import traceback
import sys
import os
def find_deepest_user_frame(tb):
tb.reverse()
# find the deepest traceback frame that is not part
# of SCons:
for frame in tb:
filename = frame[0]
if filename.find("fbt_tweaks") != -1:
continue
if filename.find(os.sep + "SCons" + os.sep) == -1:
return frame
return tb[0]
def fbt_warning(e):
filename, lineno, routine, dummy = find_deepest_user_frame(
traceback.extract_stack()
)
fbt_line = "\nfbt: warning: %s\n" % e.args[0]
sys.stderr.write(fg.boldmagenta(fbt_line))
fbt_line = (
fg.yellow("%s, line %d, " % (routine, lineno)) + 'in file "%s"\n' % filename
)
sys.stderr.write(fg.yellow(fbt_line))
def generate(env):
Warnings._warningOut = fbt_warning
def exists():
return True