ntfc 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ntfc/__init__.py ADDED
@@ -0,0 +1,26 @@
1
+ ############################################################################
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed to the Apache Software Foundation (ASF) under one or more
5
+ # contributor license agreements. See the NOTICE file distributed with
6
+ # this work for additional information regarding copyright ownership. The
7
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance with the
9
+ # License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ # License for the specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+ ############################################################################
20
+
21
+ """Top level module for NTFC."""
22
+
23
+ import importlib.metadata
24
+
25
+ # version in pyproject.toml
26
+ __version__ = importlib.metadata.version(__package__ or __name__)
ntfc/__main__.py ADDED
@@ -0,0 +1,25 @@
1
+ ############################################################################
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed to the Apache Software Foundation (ASF) under one or more
5
+ # contributor license agreements. See the NOTICE file distributed with
6
+ # this work for additional information regarding copyright ownership. The
7
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance with the
9
+ # License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ # License for the specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+ ############################################################################
20
+
21
+ """Module allowing for ``python -m ntfc ...``."""
22
+
23
+ from ntfc.cli.main import main
24
+
25
+ main() # pylint: disable=no-value-for-parameter
ntfc/builder.py ADDED
@@ -0,0 +1,227 @@
1
+ ############################################################################
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed to the Apache Software Foundation (ASF) under one or more
5
+ # contributor license agreements. See the NOTICE file distributed with
6
+ # this work for additional information regarding copyright ownership. The
7
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance with the
9
+ # License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ # License for the specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+ ############################################################################
20
+
21
+ """Build manager for NuttX configuration."""
22
+
23
+ import os
24
+ import subprocess
25
+ import sys
26
+ from pathlib import Path
27
+ from typing import Any, Dict, List, Optional
28
+
29
+ from ntfc.logger import logger
30
+
31
+
32
+ class NuttXBuilder:
33
+ """NuttX configuration builder (CMake only)."""
34
+
35
+ IMAGE_BIN_STR = "$IMAGE_BIN"
36
+ IMAGE_HEX_STR = "$IMAGE_HEX"
37
+
38
+ def __init__(self, config: Dict[str, Any], rebuild: bool = True):
39
+ """Initialize NuttX builder."""
40
+ if not isinstance(config, dict):
41
+ raise TypeError("invalid config file type")
42
+
43
+ self._cfg_values = config
44
+ self._rebuild = rebuild
45
+
46
+ def _run_command(
47
+ self, cmd: List[str], env: Any
48
+ ) -> None: # pragma: no cover
49
+ """Run command."""
50
+ subprocess.run(cmd, check=True, env=env)
51
+
52
+ def _make_dir(self, path: Path) -> None:
53
+ """Create dir."""
54
+ os.makedirs(path, exist_ok=True)
55
+
56
+ def _run_cmake(
57
+ self,
58
+ source: str,
59
+ build: str,
60
+ generator: str = "Ninja",
61
+ defines: Optional[Dict[str, str]] = None,
62
+ env: Optional[Dict[str, str]] = None,
63
+ ) -> None:
64
+ """Run CMake configure step."""
65
+ build_path = Path(build)
66
+ self._make_dir(build_path)
67
+
68
+ # base command
69
+ cmd = [
70
+ "cmake",
71
+ f"-B{build}",
72
+ f"-S{source}",
73
+ f"-G{generator}",
74
+ ]
75
+
76
+ # add -DVAR=value parameters
77
+ if defines: # pragma: no cover
78
+ for k, v in defines.items():
79
+ cmd.append(f"-D{k}={v}")
80
+
81
+ # merge environment variables
82
+ run_env = os.environ.copy()
83
+ if env:
84
+ run_env.update(env) # pragma: no cover
85
+
86
+ self._run_command(cmd, env=run_env)
87
+
88
+ def _run_build(
89
+ self, build: str, env: Optional[Dict[str, str]] = None
90
+ ) -> None:
91
+ """Run the CMake build step."""
92
+ build_path = Path(build)
93
+
94
+ cmd = [
95
+ "cmake",
96
+ "--build",
97
+ str(build_path),
98
+ ]
99
+
100
+ run_env = os.environ.copy()
101
+ if env:
102
+ run_env.update(env) # pragma: no cover
103
+
104
+ self._run_command(cmd, env=run_env)
105
+
106
+ def _build_core(
107
+ self, core: str, cores: Dict[str, Any], product: str
108
+ ) -> None:
109
+ """Build single core image."""
110
+ if "defconfig" in cores[core]:
111
+ build_dir = (
112
+ product
113
+ + "-"
114
+ + self._cfg_values[product]["name"]
115
+ + "-"
116
+ + cores[core]["name"]
117
+ )
118
+
119
+ cfg_build_dir = self._cfg_values["config"].get("build_dir", None)
120
+ if not cfg_build_dir: # pragma: no cover
121
+ print("ERROR: not found build_dir in YAML configuration!")
122
+ sys.exit(1)
123
+
124
+ cfg_cwd = self._cfg_values["config"].get("cwd", None)
125
+ if not cfg_cwd: # pragma: no cover
126
+ print("ERROR: not found cwd in YAML configuration!")
127
+ sys.exit(1)
128
+
129
+ build_path = os.path.join(cfg_build_dir, build_dir)
130
+ build_cfg = cores[core]["defconfig"]
131
+ logger.info(
132
+ f"build image " f"conf: {build_cfg}, out: {build_path}"
133
+ )
134
+
135
+ nuttx_dir = os.path.join(cfg_cwd, "nuttx")
136
+ nuttx_elf_path = os.path.join(build_path, "nuttx")
137
+ nuttx_conf_path = os.path.join(build_path, ".config")
138
+
139
+ already_build = False
140
+ if os.path.isfile(nuttx_elf_path) and os.path.isfile(
141
+ nuttx_conf_path
142
+ ):
143
+ already_build = True # pragma: no cover
144
+
145
+ # get defines passed to cmake
146
+ defines = {"BOARD_CONFIG": build_cfg}
147
+ custom_defines = cores[core].get("dcmake", [])
148
+
149
+ for d in custom_defines:
150
+ defines[d[0]] = d[1] # pragma: no cover
151
+
152
+ if not already_build or self._rebuild:
153
+ # configure build
154
+ self._run_cmake(
155
+ source=nuttx_dir,
156
+ build=build_path,
157
+ generator="Ninja",
158
+ defines=defines,
159
+ )
160
+
161
+ # build
162
+ self._run_build(build_path)
163
+
164
+ # add elf and conf path
165
+ cores[core]["elf_path"] = nuttx_elf_path
166
+ cores[core]["conf_path"] = nuttx_conf_path
167
+
168
+ def _reboot_core(
169
+ self, core: str, cores: Dict[str, Any]
170
+ ) -> None: # pragma: no cover
171
+ """Reboot single core."""
172
+ reboot_cmd = cores[core].get("reboot", None)
173
+ if reboot_cmd:
174
+ cmd = reboot_cmd.split()
175
+ logger.info(f"reboot core cmd: {cmd}")
176
+ self._run_command(cmd, env=None)
177
+
178
+ def _flash_core(
179
+ self, core: str, cores: Dict[str, Any]
180
+ ) -> None: # pragma: no cover
181
+ """Flash single core image."""
182
+ flash_cmd = cores[core].get("flash", None)
183
+ if flash_cmd:
184
+ img_path = Path(cores[core]["elf_path"])
185
+ image_hex = str(img_path.parent) + "/nuttx.hex"
186
+ image_bin = str(img_path.parent) + "/nuttx.bin"
187
+
188
+ flash_cmd = flash_cmd.replace(self.IMAGE_BIN_STR, image_bin)
189
+ flash_cmd = flash_cmd.replace(self.IMAGE_HEX_STR, image_hex)
190
+
191
+ cmd = flash_cmd.split()
192
+
193
+ logger.info(f"flash image cmd: {cmd}")
194
+ self._run_command(cmd, env=None)
195
+
196
+ def need_build(self) -> bool:
197
+ """Check if we need build something."""
198
+ for product in self._cfg_values:
199
+ if "product" in product:
200
+ cores = self._cfg_values[product]["cores"]
201
+ for core in cores:
202
+ if cores[core].get("defconfig", None):
203
+ return True
204
+ return False
205
+
206
+ def build_all(self) -> None:
207
+ """Build all defconfigs from configuration file."""
208
+ for product in self._cfg_values:
209
+ if "product" in product:
210
+ cores = self._cfg_values[product]["cores"]
211
+ for core in cores:
212
+ self._build_core(core, cores, product)
213
+
214
+ def flash_all(self) -> None:
215
+ """Flash all available images."""
216
+ for product in self._cfg_values:
217
+ if "product" in product:
218
+ cores = self._cfg_values[product]["cores"]
219
+ for core in cores:
220
+ # flash core image
221
+ self._flash_core(core, cores)
222
+ # reboot after flash
223
+ self._reboot_core(core, cores)
224
+
225
+ def new_conf(self) -> Dict[str, Any]:
226
+ """Get modified YAML config."""
227
+ return self._cfg_values
ntfc/cli/clitypes.py ADDED
@@ -0,0 +1,77 @@
1
+ ############################################################################
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed to the Apache Software Foundation (ASF) under one or more
5
+ # contributor license agreements. See the NOTICE file distributed with
6
+ # this work for additional information regarding copyright ownership. The
7
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance with the
9
+ # License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ # License for the specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+ ############################################################################
20
+
21
+ """Module containing the Click types."""
22
+
23
+ from typing import Any
24
+
25
+ import click
26
+
27
+ ############################################################################
28
+ # Decorator: testenv_options
29
+ ############################################################################
30
+
31
+
32
+ # common confpath option
33
+ _confpath_option = click.option(
34
+ "--confpath",
35
+ type=click.Path(resolve_path=False),
36
+ default="./external/config.yaml",
37
+ help="Path to test configuration file. Can be also set with "
38
+ "environment variable NTFC_CONFPATH. "
39
+ "Default: ./external/config.yaml",
40
+ envvar="NTFC_CONFPATH",
41
+ )
42
+
43
+ # common test env options
44
+
45
+ _testenv_options = (
46
+ _confpath_option,
47
+ click.option(
48
+ "--testpath",
49
+ type=click.Path(resolve_path=False),
50
+ default="./external/nuttx-testing",
51
+ help="Path to test cases. Can be also set with environment "
52
+ " variable NTFC_TESTPATH. Default: ./external/nuttx-testing.\n"
53
+ "With this option you can also narrow down the tests "
54
+ "to run by specifying the path to the test sub-module, "
55
+ "example: --testpath ./external/nuttx-testing/arch/nsh",
56
+ envvar="NTFC_TESTPATH",
57
+ ),
58
+ click.option(
59
+ "--rebuild",
60
+ is_flag=True,
61
+ help="Always rebuild configuration. Default: True",
62
+ ),
63
+ )
64
+
65
+
66
+ def cli_testenv_options(fn: Any) -> Any:
67
+ """Decorate command with common test env options decorator."""
68
+ for decorator in reversed(_testenv_options):
69
+ fn = decorator(fn)
70
+ return fn
71
+
72
+
73
+ def cli_confpath_option(fn: Any) -> Any:
74
+ """Decorate command with common test env options decorator."""
75
+ decorator = _confpath_option
76
+ fn = decorator(fn)
77
+ return fn
@@ -0,0 +1,80 @@
1
+ ############################################################################
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed to the Apache Software Foundation (ASF) under one or more
5
+ # contributor license agreements. See the NOTICE file distributed with
6
+ # this work for additional information regarding copyright ownership. The
7
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance with the
9
+ # License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ # License for the specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+ ############################################################################
20
+
21
+ """Module containing the Click environment."""
22
+
23
+ from dataclasses import dataclass
24
+ from typing import Any, Optional
25
+
26
+ import click
27
+
28
+ ###############################################################################
29
+ # Class: DEnvironmentData
30
+ ###############################################################################
31
+
32
+
33
+ @dataclass
34
+ class DEnvironmentData:
35
+ """Environment data."""
36
+
37
+ # common flags
38
+ helpnow: bool = False
39
+ debug: bool = False
40
+ verbose: bool = False
41
+
42
+ # commands to run
43
+ runcollect: bool = False
44
+ runtest: bool = False
45
+ runbuild: bool = False
46
+
47
+ # commands options
48
+ rebuild: bool = False
49
+ exitonfail: bool = False
50
+ flash: bool = False
51
+ nologs: bool = False
52
+ collect: Optional[str] = None
53
+ result: Optional[Any] = None
54
+
55
+ # files
56
+ testpath: Optional[str] = None
57
+ confpath: Optional[str] = None
58
+ jsonconf: Optional[str] = None
59
+
60
+
61
+ ###############################################################################
62
+ # Class: Environment
63
+ ###############################################################################
64
+
65
+
66
+ class Environment(DEnvironmentData):
67
+ """A class with application environment."""
68
+
69
+ def __init__(self) -> None:
70
+ """Initialize environment."""
71
+ super().__init__()
72
+
73
+
74
+ ###############################################################################
75
+ # Decorator: pass_environment
76
+ ###############################################################################
77
+
78
+
79
+ # custom environment decorator
80
+ pass_environment = click.make_pass_decorator(Environment, ensure=True)
ntfc/cli/main.py ADDED
@@ -0,0 +1,201 @@
1
+ ############################################################################
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed to the Apache Software Foundation (ASF) under one or more
5
+ # contributor license agreements. See the NOTICE file distributed with
6
+ # this work for additional information regarding copyright ownership. The
7
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance with the
9
+ # License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ # License for the specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+ ############################################################################
20
+
21
+ """Module containing the CLI logic for NTFC."""
22
+
23
+ import json
24
+ import pprint
25
+ import sys
26
+ from typing import Any, Dict, List, Tuple
27
+
28
+ import click
29
+ import yaml # type: ignore
30
+
31
+ from ntfc.builder import NuttXBuilder
32
+ from ntfc.cli.environment import Environment, pass_environment
33
+ from ntfc.logger import logger
34
+ from ntfc.plugins_loader import commands_list
35
+ from ntfc.pytest.mypytest import MyPytest
36
+
37
+ ###############################################################################
38
+ # Function: main
39
+ ###############################################################################
40
+
41
+
42
+ @click.group()
43
+ @click.option(
44
+ "--debug/--no-debug",
45
+ default=False,
46
+ is_flag=True,
47
+ )
48
+ @click.option(
49
+ "--verbose/--no-verbose",
50
+ default=False,
51
+ is_flag=True,
52
+ )
53
+ @pass_environment
54
+ def main(ctx: Environment, debug: bool, verbose: bool) -> bool:
55
+ """VFTC - NuttX Testing Framework for Community."""
56
+ ctx.debug = debug
57
+ ctx.verbose = verbose
58
+
59
+ if debug: # pragma: no cover
60
+ logger.setLevel("DEBUG")
61
+ else:
62
+ logger.setLevel("INFO")
63
+
64
+ # handle work after all commands are parsed
65
+ click.get_current_context().call_on_close(cli_on_close)
66
+
67
+ # check if --help was called
68
+ if "--help" in sys.argv[1:]: # pragma: no cover
69
+ ctx.helpnow = True
70
+
71
+ return True
72
+
73
+
74
+ def collect_print_skipped(items: List[Tuple[Any, str]]) -> None:
75
+ """Print skipped tests and reason."""
76
+ if items:
77
+ print("Skipped tests:")
78
+ for item in items:
79
+ print(f"{item[0].location[0]}:{item[0].location[2]}: \n => {item[1]}")
80
+
81
+
82
+ def collect_print_modules(modules: List[str]) -> None:
83
+ """Print collected modules."""
84
+ print("Modules:")
85
+ for m in modules:
86
+ print(m)
87
+
88
+
89
+ def collect_run(pt: MyPytest, ctx: Environment) -> None:
90
+ """Collect tests."""
91
+ assert ctx.testpath is not None
92
+ col = pt.collect(ctx.testpath)
93
+
94
+ print("\nCollect summary:")
95
+ print(
96
+ f" all: {len(col.allitems)}"
97
+ f" filtered: {len(col.items)}"
98
+ f" skipped: {len(col.skipped)}"
99
+ )
100
+
101
+ if ctx.collect == "silent":
102
+ return
103
+
104
+ if ctx.collect in ("collected", "all"):
105
+ print()
106
+ print("Collected items:")
107
+ # print parsed test cases
108
+ for item in col.items:
109
+ print(item)
110
+
111
+ if ctx.collect in ("skipped", "all"):
112
+ # print skipped test cases
113
+ collect_print_skipped(col.skipped)
114
+
115
+ if ctx.collect in ("modules", "all"):
116
+ collect_print_modules(col.modules)
117
+
118
+
119
+ def test_run(pt: MyPytest, ctx: Environment) -> Any:
120
+ """Run tests."""
121
+ assert ctx.testpath is not None
122
+ assert ctx.result is not None
123
+ return pt.runner(ctx.testpath, ctx.result, ctx.nologs)
124
+
125
+
126
+ def print_yaml_config(config: Dict[str, Any]) -> None:
127
+ """Print YAML configuration."""
128
+ print("YAML config:")
129
+ pp = pprint.PrettyPrinter()
130
+ pp.pprint(config)
131
+
132
+
133
+ def print_json_config(config: Dict[str, Any]) -> None:
134
+ """Print JSON configuration."""
135
+ print("JSON config:")
136
+ pp = pprint.PrettyPrinter()
137
+ pp.pprint(config)
138
+
139
+
140
+ @pass_environment
141
+ def cli_on_close(ctx: Environment) -> bool:
142
+ """Handle all work on Click close."""
143
+ if ctx.helpnow: # pragma: no cover
144
+ # do nothing if help was called
145
+ return True
146
+
147
+ conf = None
148
+ logger.info(f"YAML config file {ctx.confpath}")
149
+ assert ctx.confpath is not None
150
+ with open(ctx.confpath, "r", encoding="utf-8") as f:
151
+ conf = yaml.safe_load(f)
152
+
153
+ conf_json = {}
154
+ if ctx.jsonconf: # pragma: no cover
155
+ logger.info(f"Module config file {ctx.jsonconf}")
156
+ with open(ctx.jsonconf, "r", encoding="utf-8") as f:
157
+ conf_json = json.load(f)
158
+
159
+ print_yaml_config(conf)
160
+ print_json_config(conf_json)
161
+
162
+ builder = NuttXBuilder(conf, ctx.rebuild)
163
+ if builder.need_build():
164
+ builder.build_all()
165
+ if ctx.flash:
166
+ builder.flash_all()
167
+
168
+ # update config
169
+ conf = builder.new_conf()
170
+
171
+ # exit now when build only mode
172
+ if ctx.runbuild:
173
+ return True
174
+
175
+ pt = MyPytest(conf, ctx.exitonfail, ctx.verbose, conf_json)
176
+
177
+ if ctx.runcollect:
178
+ collect_run(pt, ctx)
179
+
180
+ if ctx.runtest:
181
+ ret = test_run(pt, ctx)
182
+ if ret != 0:
183
+ exit(1)
184
+
185
+ return True
186
+
187
+
188
+ ###############################################################################
189
+ # Function: click_final_init
190
+ ###############################################################################
191
+
192
+
193
+ def click_final_init() -> None:
194
+ """Handle final Click initialization."""
195
+ # add interfaces
196
+ for cmd in commands_list:
197
+ main.add_command(cmd)
198
+
199
+
200
+ # final click initialization
201
+ click_final_init()
@@ -0,0 +1,49 @@
1
+ ############################################################################
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed to the Apache Software Foundation (ASF) under one or more
5
+ # contributor license agreements. See the NOTICE file distributed with
6
+ # this work for additional information regarding copyright ownership. The
7
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance with the
9
+ # License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ # License for the specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+ ############################################################################
20
+
21
+ """Module containing NTFC collect command."""
22
+
23
+ import click
24
+
25
+ from ntfc.cli.clitypes import cli_confpath_option
26
+ from ntfc.cli.environment import Environment, pass_environment
27
+
28
+ ###############################################################################
29
+ # Command: cmd_build
30
+ ###############################################################################
31
+
32
+
33
+ @click.command(name="build")
34
+ @cli_confpath_option
35
+ @click.option(
36
+ "--flash/--no-flash",
37
+ is_flag=True,
38
+ default=True,
39
+ help="Flash image. Default: True",
40
+ )
41
+ @pass_environment
42
+ def cmd_build(ctx: Environment, confpath: str, flash: bool) -> bool:
43
+ """Build only command."""
44
+ ctx.runbuild = True
45
+ ctx.rebuild = True
46
+ ctx.confpath = confpath
47
+ ctx.flash = flash
48
+
49
+ return True