Skip to content

Commit f4a6a45

Browse files
committed
Only update signing header if pubkey present
1 parent a3c7bc9 commit f4a6a45

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

builder/main.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -228,21 +228,23 @@ def generate_uf2(target, source, env):
228228
is_arduino_pico_build = env.BoardConfig().get("build.core", "arduino") == "earlephilhower" and "arduino" in env.get("PIOFRAMEWORK")
229229
target_gen_header = None
230230
if is_arduino_pico_build:
231-
header_file = join(env.subst("$BUILD_DIR"), "core", "Updater_Signing.h")
232-
env.Prepend(CFLAGS=['-I"%s"' % join("$BUILD_DIR", "core")])
233-
signing_header_cmd = env.Command(
234-
join("$BUILD_DIR", "core", "Updater_Signing.h"), # $TARGET
235-
join("$PROJECT_SRC_DIR", "public.key"), # $SOURCE
236-
env.VerboseAction(" ".join([
237-
'"$PYTHONEXE" "%s"' % join(
238-
platform.get_package_dir("framework-arduinopico"), "tools", "signing.py"),
239-
"--mode", "header",
240-
"--publickey", '"$SOURCE"',
241-
"--out", "$TARGET"
242-
]), "Generating $TARGET")
243-
)
244-
target_gen_header = env.Alias("gen_header", signing_header_cmd)
245-
AlwaysBuild(target_gen_header)
231+
pubkey = join(env.subst("$PROJECT_SRC_DIR"), "public.key")
232+
if isfile(pubkey):
233+
header_file = join(env.subst("$BUILD_DIR"), "core", "Updater_Signing.h")
234+
env.Prepend(CFLAGS=['-I"%s"' % join("$BUILD_DIR", "core")])
235+
signing_header_cmd = env.Command(
236+
join("$BUILD_DIR", "core", "Updater_Signing.h"), # $TARGET
237+
join("$PROJECT_SRC_DIR", "public.key"), # $SOURCE
238+
env.VerboseAction(" ".join([
239+
'"$PYTHONEXE" "%s"' % join(
240+
platform.get_package_dir("framework-arduinopico"), "tools", "signing.py"),
241+
"--mode", "header",
242+
"--publickey", '"$SOURCE"',
243+
"--out", "$TARGET"
244+
]), "Generating $TARGET")
245+
)
246+
target_gen_header = env.Alias("gen_header", signing_header_cmd)
247+
AlwaysBuild(target_gen_header)
246248

247249
#
248250
# Target: Build executable and linkable firmware

0 commit comments

Comments
 (0)