From eacfab99ccce02a3dbd589e27db6b0807181f111 Mon Sep 17 00:00:00 2001 From: Ramon Roche Date: Wed, 8 Apr 2026 21:12:36 -0700 Subject: [PATCH] fix(manifest): correct px_mkfw shebang order and _merge_manifest logic Move the shebang to line 1 so direct execution works on Linux; the vim modeline was sitting above it and silently breaking ./Tools/px_mkfw.py. Fix _merge_manifest to only merge dict values into dst["hardware"] when the key is "hardware". The previous structure ran the isinstance check unconditionally, so any dict-valued field in the fragment would have been shoved into dst["hardware"] regardless of its key, and could KeyError if a non-"hardware" dict arrived first. It only worked today because "hardware" happened to be the only dict in the fragment. Signed-off-by: Ramon Roche --- Tools/px_mkfw.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Tools/px_mkfw.py b/Tools/px_mkfw.py index cce6132787..59a4e018fd 100755 --- a/Tools/px_mkfw.py +++ b/Tools/px_mkfw.py @@ -1,5 +1,5 @@ -# vim: set noexpandtab tabstop=4 shiftwidth=4: #!/usr/bin/env python3 +# vim: set noexpandtab tabstop=4 shiftwidth=4: ############################################################################ # # Copyright (C) 2012, 2013 PX4 Development Team. All rights reserved. @@ -72,10 +72,8 @@ def _merge_manifest(dst, src): if not isinstance(src, dict): return for k, v in src.items(): - if k == "hardware": - dst.setdefault("hardware", {}) - if isinstance(v, dict): - dst["hardware"].update(v) + if k == "hardware" and isinstance(v, dict): + dst.setdefault("hardware", {}).update(v) else: dst[k] = v