Skip to content

Commit f7297d3

Browse files
[nrf noup] Fix zap-generate script
There is a wrong logic for providing a custom zcl file. Signed-off-by: Arkadiusz Balys <[email protected]>
1 parent fe650a3 commit f7297d3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/west/zap_generate.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def do_add_parser(self, parser_adder):
5858
default=DEFAULT_MATTER_PATH, help='Path to Matter SDK')
5959
parser.add_argument('-f', '--full', action='store_true', help='Generate full data model files')
6060
parser.add_argument('-k', '--keep-previous', action='store_true', help='Keep previously generated files')
61-
parser.add_argument('-j', '--zcl', action='store_true', help='Generate clusters from zcl.json')
61+
parser.add_argument('-j', '--zcl', type=existing_file_path, help='Generate clusters from zcl.json')
6262
parser.add_argument('-y', '--yaml', type=existing_file_path,
6363
help='Yaml file containing list of zap files to be used for generation. The file must contain the first entry as "base_dir" which is the relative path to the ZEPHYR_BASE directory. Then each other entry must contain the "name", "zap_file" and optionally "full" and "zcl_file"')
6464
return parser
@@ -117,7 +117,15 @@ def do_run(self, args, unknown_args):
117117
if not zap_file_path:
118118
raise CommandError("No valid .zap file provided")
119119

120-
zap_files.append(ZapFile(name=zap_file_path.stem, zap_file=Path(zap_file_path), full=args.full, zcl_file=args.zcl))
120+
if args.zcl:
121+
zcl_file = args.zcl.absolute()
122+
elif (zap_file_path.parent / "zcl.json").exists():
123+
zcl_file = zap_file_path.parent / "zcl.json"
124+
else:
125+
zcl_file = None
126+
127+
zap_files.append(ZapFile(name=zap_file_path.stem, zap_file=Path(
128+
zap_file_path), full=args.full, zcl_file=zcl_file))
121129

122130
# Generate the zap file
123131
for zap in zap_files:

0 commit comments

Comments
 (0)