Skip to content

Commit 5dfe750

Browse files
committed
[nrf noup] Add zap-install command
Add west command to install ZAP Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no>
1 parent e5c04b2 commit 5dfe750

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

scripts/west/west-commands.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Keep the help strings in sync with the values in the .py files!
22
west-commands:
3+
- file: scripts/west/zap_install.py
4+
commands:
5+
- name: zap-install
6+
class: ZapInstall
7+
help: Install Matter ZCL Advanced Platform (ZAP) GUI
38
- file: scripts/west/zap_generate.py
49
commands:
510
- name: zap-generate

scripts/west/zap_install.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) 2025 Nordic Semiconductor ASA
2+
#
3+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
4+
5+
import argparse
6+
from textwrap import dedent
7+
from west.commands import WestCommand
8+
from zap_common import existing_dir_path, ZapInstaller, DEFAULT_MATTER_PATH
9+
10+
11+
class ZapInstall(WestCommand):
12+
13+
def __init__(self):
14+
super().__init__(
15+
'zap-install',
16+
'Install Matter ZCL Advanced Platform (ZAP) GUI',
17+
dedent('''
18+
Install Matter ZCL Advanced Platform (ZAP) GUI.
19+
20+
The ZAP GUI in a node.js tool for configuring the data model
21+
of a Matter application, which defines clusters, commands,
22+
attributes and events enabled for the given application.'''))
23+
24+
def do_add_parser(self, parser_adder):
25+
parser = parser_adder.add_parser(self.name,
26+
help=self.help,
27+
formatter_class=argparse.RawDescriptionHelpFormatter,
28+
description=self.description)
29+
parser.add_argument('-m', '--matter-path', type=existing_dir_path,
30+
default=DEFAULT_MATTER_PATH, help=f'Path to Matter SDK. Default is set to {DEFAULT_MATTER_PATH}')
31+
return parser
32+
33+
def do_run(self, args, unknown_args):
34+
zap_installer = ZapInstaller(args.matter_path)
35+
zap_installer.update_zap_if_needed()

0 commit comments

Comments
 (0)