mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-21 04:11:48 +03:00
c3ececcf96
* ufbt: added "dolphin_ext" target (expects "external" subfolder in cwd with dolphin assets); cleaned up unused code * ufbt: codestyle fixes * scripts: fixed style according to ruff linter * scripts: additional cleanup & codestyle fixes * github: pass target hw code when installing local SDK with ufbt * ufbt: added error message for missing folder in dolphin builder * scripts: more linter fixes * sdk: added flipper_format_stream; ufbt: support for --extra-define * fbt: reduced amount of global defines * scripts, fbt: rearranged imports Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
49 lines
1.2 KiB
Python
49 lines
1.2 KiB
Python
import os
|
|
import sys
|
|
import traceback
|
|
|
|
import SCons.Warnings as Warnings
|
|
from ansi.color import fg
|
|
from SCons.Errors import UserError
|
|
|
|
# from SCons.Script.Main import find_deepest_user_frame
|
|
|
|
|
|
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):
|
|
if env.get("UFBT_WORK_DIR"):
|
|
raise UserError(
|
|
"You're trying to use a new format SDK on a legacy ufbt version. "
|
|
"Please update ufbt to a version from PyPI: https://pypi.org/project/ufbt/"
|
|
)
|
|
Warnings._warningOut = fbt_warning
|
|
|
|
|
|
def exists():
|
|
return True
|