Skip to content

Commit

Permalink
fbt: naming changes to reflect private nature of scons tools
Browse files Browse the repository at this point in the history
  • Loading branch information
hedger committed Oct 25, 2023
1 parent 54e8711 commit 1ad55b2
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 33 deletions.
24 changes: 12 additions & 12 deletions scripts/fbt_tools/fbt_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from SCons.Node.FS import File


def icons_emitter(target, source, env):
def _icons_emitter(target, source, env):
icons_src = env.GlobRecursive("*.png", env["ICON_SRC_DIR"])
icons_src += env.GlobRecursive("**/frame_rate", env["ICON_SRC_DIR"])

Expand All @@ -19,7 +19,7 @@ def icons_emitter(target, source, env):
return target, icons_src


def proto_emitter(target, source, env):
def _proto_emitter(target, source, env):
target = []
for src in source:
basename = os.path.splitext(src.name)[0]
Expand All @@ -28,7 +28,7 @@ def proto_emitter(target, source, env):
return target, source


def dolphin_emitter(target, source, env):
def _dolphin_emitter(target, source, env):
res_root_dir = source[0].Dir(env["DOLPHIN_RES_TYPE"])
source = [res_root_dir]
source.extend(env.GlobRecursive("*.*", res_root_dir.srcnode()))
Expand Down Expand Up @@ -65,7 +65,7 @@ def dolphin_emitter(target, source, env):
return target, source


def _invoke_git(args, source_dir):
def __invoke_git(args, source_dir):
cmd = ["git"]
cmd.extend(args)
return (
Expand All @@ -75,11 +75,11 @@ def _invoke_git(args, source_dir):
)


def proto_ver_generator(target, source, env):
def _proto_ver_generator(target, source, env):
target_file = target[0]
src_dir = source[0].dir.abspath
try:
_invoke_git(
__invoke_git(
["fetch", "--tags"],
source_dir=src_dir,
)
Expand All @@ -88,7 +88,7 @@ def proto_ver_generator(target, source, env):
print(fg.boldred("Git: fetch failed"))

try:
git_describe = _invoke_git(
git_describe = __invoke_git(
["describe", "--tags", "--abbrev=0"],
source_dir=src_dir,
)
Expand Down Expand Up @@ -147,7 +147,7 @@ def generate(env):
],
"${ICONSCOMSTR}",
),
emitter=icons_emitter,
emitter=_icons_emitter,
),
"ProtoBuilder": Builder(
action=Action(
Expand All @@ -163,7 +163,7 @@ def generate(env):
],
"${PROTOCOMSTR}",
),
emitter=proto_emitter,
emitter=_proto_emitter,
suffix=".pb.c",
src_suffix=".proto",
),
Expand All @@ -182,7 +182,7 @@ def generate(env):
],
"${DOLPHINCOMSTR}",
),
emitter=dolphin_emitter,
emitter=_dolphin_emitter,
),
"DolphinExtBuilder": Builder(
action=Action(
Expand All @@ -197,11 +197,11 @@ def generate(env):
],
"${DOLPHINCOMSTR}",
),
emitter=dolphin_emitter,
emitter=_dolphin_emitter,
),
"ProtoVerBuilder": Builder(
action=Action(
proto_ver_generator,
_proto_ver_generator,
"${PBVERCOMSTR}",
),
),
Expand Down
8 changes: 4 additions & 4 deletions scripts/fbt_tools/fbt_extapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def prepare_app_metadata(target, source, env):
)


def validate_app_imports(target, source, env):
def _validate_app_imports(target, source, env):
sdk_cache = SdkCache(env["SDK_DEFINITION"].path, load_version_only=False)
app_syms = set()
with open(target[0].path, "rt") as f:
Expand Down Expand Up @@ -340,7 +340,7 @@ def GetExtAppByIdOrPath(env, app_dir):
return app_artifacts


def embed_app_metadata_emitter(target, source, env):
def _embed_app_metadata_emitter(target, source, env):
app = env["APP"]

# Hack: change extension for fap libs
Expand Down Expand Up @@ -526,7 +526,7 @@ def generate(env, **kw):
generator=generate_embed_app_metadata_actions,
suffix=".fap",
src_suffix=".elf",
emitter=embed_app_metadata_emitter,
emitter=_embed_app_metadata_emitter,
),
"ValidateAppImports": Builder(
action=[
Expand All @@ -535,7 +535,7 @@ def generate(env, **kw):
None, # "$APPDUMP_COMSTR",
),
Action(
validate_app_imports,
_validate_app_imports,
"$APPCHECK_COMSTR",
),
],
Expand Down
1 change: 0 additions & 1 deletion scripts/fbt_tools/fbt_resources.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import shutil

from ansi.color import fg
from SCons.Action import Action
from SCons.Builder import Builder
from SCons.Errors import StopError
Expand Down
24 changes: 12 additions & 12 deletions scripts/fbt_tools/fbt_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ def ProcessSdkDepends(env, filename):
return depends


def api_amalgam_emitter(target, source, env):
def _api_amalgam_emitter(target, source, env):
target.append(env.ChangeFileExtension(target[0], ".d"))
target.append(env.ChangeFileExtension(target[0], ".i.c"))
return target, source


def api_amalgam_gen_origin_header(target, source, env):
def _api_amalgam_gen_origin_header(target, source, env):
mega_file = env.subst("${TARGET}.c", target=target[0])
with open(mega_file, "wt") as sdk_c:
sdk_c.write(
Expand Down Expand Up @@ -183,12 +183,12 @@ def deploy_action(self):
self._generate_sdk_meta()


def deploy_sdk_header_tree_action(target, source, env):
def _deploy_sdk_header_tree_action(target, source, env):
sdk_tree = SdkTreeBuilder(env, target, source)
return sdk_tree.deploy_action()


def deploy_sdk_header_tree_emitter(target, source, env):
def _deploy_sdk_header_tree_emitter(target, source, env):
sdk_tree = SdkTreeBuilder(env, target, source)
return sdk_tree.emitter(target, source, env)

Expand Down Expand Up @@ -227,7 +227,7 @@ def _check_sdk_is_up2date(sdk_cache: SdkCache):
)


def validate_api_cache(source, target, env):
def _validate_api_cache(source, target, env):
# print(f"Generating SDK for {source[0]} to {target[0]}")
current_sdk = SdkCollector()
current_sdk.process_source_file_for_sdk(source[0].path)
Expand All @@ -240,7 +240,7 @@ def validate_api_cache(source, target, env):
_check_sdk_is_up2date(sdk_cache)


def generate_api_table(source, target, env):
def _generate_api_table(source, target, env):
sdk_cache = SdkCache(source[0].path)
_check_sdk_is_up2date(sdk_cache)

Expand Down Expand Up @@ -278,10 +278,10 @@ def generate(env, **kw):
env.Append(
BUILDERS={
"ApiAmalgamator": Builder(
emitter=api_amalgam_emitter,
emitter=_api_amalgam_emitter,
action=[
Action(
api_amalgam_gen_origin_header,
_api_amalgam_gen_origin_header,
"$SDK_AMALGAMATE_HEADER_COMSTR",
),
Action(
Expand All @@ -293,23 +293,23 @@ def generate(env, **kw):
),
"SDKHeaderTreeExtractor": Builder(
action=Action(
deploy_sdk_header_tree_action,
_deploy_sdk_header_tree_action,
"$SDKTREE_COMSTR",
),
emitter=deploy_sdk_header_tree_emitter,
emitter=_deploy_sdk_header_tree_emitter,
src_suffix=".d",
),
"ApiTableValidator": Builder(
action=Action(
validate_api_cache,
_validate_api_cache,
"$SDKSYM_UPDATER_COMSTR",
),
suffix=".csv",
src_suffix=".i",
),
"ApiSymbolTable": Builder(
action=Action(
generate_api_table,
_generate_api_table,
"$APITABLE_GENERATOR_COMSTR",
),
suffix=".h",
Expand Down
4 changes: 2 additions & 2 deletions scripts/fbt_tools/fbt_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from SCons.Builder import Builder


def version_emitter(target, source, env):
def _version_emitter(target, source, env):
target_dir = target[0]
target = [
target_dir.File("version.inc.h"),
Expand All @@ -24,7 +24,7 @@ def generate(env):
'-o ${TARGET.dir.posix} --dir "${ROOT_DIR}"',
"${VERSIONCOMSTR}",
),
emitter=version_emitter,
emitter=_version_emitter,
),
}
)
Expand Down
4 changes: 2 additions & 2 deletions scripts/fbt_tools/pvsstudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _set_browser_action(target, source, env):
__no_browser = True


def emit_pvsreport(target, source, env):
def _emit_pvsreport(target, source, env):
target_dir = env["REPORT_DIR"]
if env["PLATFORM"] == "win32":
# Report generator on Windows emits to a subfolder of given output folder
Expand Down Expand Up @@ -96,7 +96,7 @@ def generate(env):
],
"${PVSCONVCOMSTR}",
),
emitter=emit_pvsreport,
emitter=_emit_pvsreport,
src_suffix=".log",
),
}
Expand Down

0 comments on commit 1ad55b2

Please sign in to comment.