idf-build-apps 2.1.1__tar.gz → 2.2.1__tar.gz

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.
Files changed (65) hide show
  1. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.git-blame-ignore-revs +1 -0
  2. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.github/workflows/check-pre-commit.yml +1 -1
  3. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.pre-commit-config.yaml +6 -18
  4. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/CHANGELOG.md +12 -0
  5. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/PKG-INFO +1 -1
  6. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/conf.py +14 -16
  7. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/manifest.md +98 -74
  8. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/__init__.py +2 -2
  9. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/app.py +31 -35
  10. idf_build_apps-2.2.1/idf_build_apps/junit/__init__.py +10 -0
  11. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/junit/report.py +13 -11
  12. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/log.py +2 -2
  13. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/main.py +10 -12
  14. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/manifest/if_parser.py +10 -9
  15. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/manifest/manifest.py +70 -8
  16. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/manifest/soc_header.py +10 -14
  17. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/session_args.py +3 -3
  18. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/utils.py +7 -13
  19. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/yaml/parser.py +21 -5
  20. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/pyproject.toml +41 -16
  21. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/setup.py +1 -1
  22. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/tests/test_build.py +7 -7
  23. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/tests/test_finder.py +33 -31
  24. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/tests/test_manifest.py +159 -4
  25. idf_build_apps-2.1.1/idf_build_apps/junit/__init__.py +0 -10
  26. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.editorconfig +0 -0
  27. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.gitattributes +0 -0
  28. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.github/dependabot.yml +0 -0
  29. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.github/workflows/issue_comment.yml +0 -0
  30. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.github/workflows/new_issues.yml +0 -0
  31. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.github/workflows/new_prs.yml +0 -0
  32. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.github/workflows/publish-pypi.yml +0 -0
  33. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.github/workflows/test-build-docs.yml +0 -0
  34. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.github/workflows/test-build-idf-apps.yml +0 -0
  35. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.gitignore +0 -0
  36. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/.readthedocs.yml +0 -0
  37. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/CONTRIBUTING.md +0 -0
  38. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/LICENSE +0 -0
  39. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/README.md +0 -0
  40. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/CHANGELOG.md +0 -0
  41. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/CONTRIBUTING.md +0 -0
  42. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/Makefile +0 -0
  43. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/_apidoc_templates/module.rst_t +0 -0
  44. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/_apidoc_templates/package.rst_t +0 -0
  45. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/_apidoc_templates/toc.rst_t +0 -0
  46. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/_static/espressif-logo.svg +0 -0
  47. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/_static/theme_overrides.css +0 -0
  48. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/_templates/layout.html +0 -0
  49. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/cli.rst +0 -0
  50. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/config_file.md +0 -0
  51. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/find_build.md +0 -0
  52. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/index.rst +0 -0
  53. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/docs/migration/1.x_to_2.x.md +0 -0
  54. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/__main__.py +0 -0
  55. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/build_apps_args.py +0 -0
  56. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/config.py +0 -0
  57. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/constants.py +0 -0
  58. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/finder.py +0 -0
  59. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/junit/utils.py +0 -0
  60. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/manifest/__init__.py +0 -0
  61. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/idf_build_apps/yaml/__init__.py +0 -0
  62. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/license_header.txt +0 -0
  63. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/tests/conftest.py +0 -0
  64. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/tests/test_app.py +0 -0
  65. {idf_build_apps-2.1.1 → idf_build_apps-2.2.1}/tests/test_utils.py +0 -0
@@ -3,3 +3,4 @@ aeeb64c027a3a0db195749fcba206620e7c9060e
3
3
  e9d5def7afa2f960da7d7b5863cea95e32898509
4
4
  703aec369076479d3d841003f0e193d02df43505
5
5
  dd8d3634c410c444029e1640e83a5c2f3280be47
6
+ f146380f3268c8820d2762155863c3aec40411bc
@@ -13,6 +13,6 @@ jobs:
13
13
  - uses: actions/setup-python@v5
14
14
  - id: changed-files
15
15
  uses: tj-actions/changed-files@v42
16
- - uses: pre-commit/action@v3.0.0
16
+ - uses: pre-commit/action@v3.0.1
17
17
  with:
18
18
  extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}
@@ -6,9 +6,8 @@ repos:
6
6
  - id: end-of-file-fixer
7
7
  - id: mixed-line-ending
8
8
  args: [ '-f=lf' ]
9
- - id: double-quote-string-fixer
10
9
  - repo: https://github.com/Lucas-C/pre-commit-hooks
11
- rev: v1.5.4
10
+ rev: v1.5.5
12
11
  hooks:
13
12
  - id: insert-license
14
13
  files: \.py$
@@ -16,26 +15,15 @@ repos:
16
15
  - --license-filepath
17
16
  - license_header.txt # defaults to: LICENSE.txt
18
17
  - --use-current-year
19
- - repo: https://github.com/asottile/pyupgrade
20
- rev: v3.15.0
21
- hooks:
22
- - id: pyupgrade
23
- args: [--py37-plus]
24
- - repo: https://github.com/pycqa/isort
25
- rev: 5.12.0
26
- hooks:
27
- - id: isort
28
- - repo: https://github.com/psf/black
29
- rev: 23.11.0
30
- hooks:
31
- - id: black
32
18
  - repo: https://github.com/charliermarsh/ruff-pre-commit
33
- rev: 'v0.1.7'
19
+ rev: 'v0.2.1'
34
20
  hooks:
35
21
  - id: ruff
36
- args: ['--fix']
22
+ args: ['--fix', '--preview']
23
+ - id: ruff-format
24
+ args: ['--preview']
37
25
  - repo: https://github.com/pre-commit/mirrors-mypy
38
- rev: 'v1.7.1'
26
+ rev: 'v1.8.0'
39
27
  hooks:
40
28
  - id: mypy
41
29
  args: ['--warn-unused-ignores']
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## v2.2.1 (2024-03-04)
6
+
7
+ ### Fix
8
+
9
+ - override sdkconfig item keep possible double quotes
10
+
11
+ ## v2.2.0 (2024-02-22)
12
+
13
+ ### Feat
14
+
15
+ - Support switch-like statements in `depends_components`, and `depends_filepatterns`
16
+
5
17
  ## v2.1.1 (2024-02-02)
6
18
 
7
19
  ### Fix
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: idf-build-apps
3
- Version: 2.1.1
3
+ Version: 2.2.1
4
4
  Summary: Tools for building ESP-IDF related apps.
5
5
  Author-email: Fu Hanxi <fuhanxi@espressif.com>
6
6
  Requires-Python: >=3.7
@@ -1,4 +1,4 @@
1
- # SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
1
+ # SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2
2
  # SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import os
@@ -15,7 +15,7 @@ import subprocess
15
15
 
16
16
  project = 'idf-build-apps'
17
17
  project_homepage = 'https://github.com/espressif/idf-build-apps'
18
- copyright = '2023, Espressif Systems (Shanghai) Co., Ltd.'
18
+ copyright = '2023, Espressif Systems (Shanghai) Co., Ltd.' # noqa: A001
19
19
  author = 'Fu Hanxi'
20
20
 
21
21
  # -- General configuration ---------------------------------------------------
@@ -52,17 +52,15 @@ docs_dir = os.path.dirname(__file__)
52
52
  api_dir = os.path.join(docs_dir, 'api')
53
53
  if os.path.isdir(api_dir):
54
54
  shutil.rmtree(api_dir)
55
- subprocess.run(
56
- [
57
- 'sphinx-apidoc',
58
- os.path.join(docs_dir, '..', 'idf_build_apps'),
59
- '-f',
60
- '-H',
61
- 'API Reference',
62
- '--no-headings',
63
- '-t',
64
- '_apidoc_templates',
65
- '-o',
66
- api_dir,
67
- ]
68
- )
55
+ subprocess.run([
56
+ 'sphinx-apidoc',
57
+ os.path.join(docs_dir, '..', 'idf_build_apps'),
58
+ '-f',
59
+ '-H',
60
+ 'API Reference',
61
+ '--no-headings',
62
+ '-t',
63
+ '_apidoc_templates',
64
+ '-o',
65
+ api_dir,
66
+ ])
@@ -78,80 +78,6 @@ examples/foo/bar:
78
78
  - if: IDF_TARGET == "esp32s2"
79
79
  ```
80
80
 
81
- ## Enhanced YAML Syntax
82
-
83
- ### Reuse Lists
84
-
85
- To reuse the items defined in a list, you can use the `+` and `-` postfixes respectively. The order of calculation is always `+` first, followed by `-`.
86
-
87
- #### Array Elements as Strings
88
-
89
- The following YAML code demonstrates how to reuse the elements from a list of strings:
90
-
91
- ```yaml
92
- .base_depends_components: &base-depends-components
93
- depends_components:
94
- - esp_hw_support
95
- - esp_rom
96
- - esp_wifi
97
-
98
- examples/wifi/coexist:
99
- <<: *base-depends-components
100
- depends_components+:
101
- - esp_coex
102
- depends_components-:
103
- - esp_rom
104
- ```
105
-
106
- After interpretation, the resulting YAML will be:
107
-
108
- ```yaml
109
- examples/wifi/coexist:
110
- depends_components:
111
- - esp_hw_support
112
- - esp_wifi
113
- - esp_coex
114
- ```
115
-
116
- This means that the `esp_rom` element is removed, and the `esp_coex` element is added to the `depends_components` list.
117
-
118
- #### Array Elements as Dictionaries
119
-
120
- In addition to reuse elements from a list of strings, you can also perform these operations on a list of dictionaries. The matching is done based on the `if` key. Here's an example:
121
-
122
- ```yaml
123
- .base: &base
124
- enable:
125
- - if: IDF_VERSION == "5.2.0"
126
- - if: IDF_VERSION == "5.3.0"
127
-
128
- foo:
129
- <<: *base
130
- enable+:
131
- # this if statement dictionary will override the one defined in `&base`
132
- - if: IDF_VERSION == "5.2.0"
133
- temp: true
134
- - if: IDF_VERSION == "5.4.0"
135
- reason: bar
136
- ```
137
-
138
- After interpretation, the resulting YAML will be:
139
-
140
- ```yaml
141
- foo:
142
- enable:
143
- - if: IDF_VERSION == "5.3.0"
144
- - if: IDF_VERSION == "5.2.0"
145
- temp: true
146
- - if: IDF_VERSION == "5.4.0"
147
- reason: bar
148
- ```
149
-
150
- In this case, the `enable` list is extended with the new `if` statement and `reason` dictionary.
151
- It's important to note that the `if` dictionary defined in the `+` postfix will override the earlier one when the `if` statement matches.
152
-
153
- This demonstrates how you can use the `+` and `-` postfixes to extend and remove elements from both string and dictionary lists in our YAML.
154
-
155
81
  ## Practical Example
156
82
 
157
83
  Here's a practical example:
@@ -250,3 +176,101 @@ This app will not be built with the following CLI options:
250
176
  Low-level dependencies, are components or files that are used by many others. For example, component `freertos` provides the operating system support for all apps, and ESP-IDF build system related cmake files are also used by all apps. When these items are modified, we definitely need to build and test all the apps.
251
177
 
252
178
  To disable the build-apps-only-on-related-changes feature, you can use the CLI option `--ignore-app-dependencies-filepatterns`. Once any of the modified files matches the specified patterns, the special rules will be disabled. All apps will be built, no exceptions.
179
+
180
+ ## Enhanced YAML Syntax
181
+
182
+ ### Switch-Like Clauses
183
+
184
+ The Switch-Like clauses are supported by two keywords in the YAML file: `depends_components` and `depends_filepatterns`.
185
+
186
+ #### Operands
187
+
188
+ Switch cases have two main components: the `if` clause and the `default` clause. Just like a switch statement in c language, The first matched `if` clause will be applied. If no `if` clause matched, the `default` clause will be applied. Here's an example:
189
+
190
+ ```yaml
191
+ test1:
192
+ depends_components:
193
+ - if: IDF_VERSION == "{IDF_VERSION}"
194
+ content: [ "component_1" ]
195
+ - if: CONFIG_NAME == "AWESOME_CONFIG"
196
+ content: [ "component_2" ]
197
+ - default: [ "component_3", "component_4" ]
198
+ ```
199
+
200
+ `default` clause is optional. If you don't specify any `default` clause, it will return an empty array.
201
+
202
+ #### Limitations
203
+
204
+ You cannot combine a list and a switch in one node.
205
+
206
+ ### Reuse Lists
207
+
208
+ To reuse the items defined in a list, you can use the `+` and `-` postfixes respectively. The order of calculation is always `+` first, followed by `-`.
209
+
210
+ #### Array Elements as Strings
211
+
212
+ The following YAML code demonstrates how to reuse the elements from a list of strings:
213
+
214
+ ```yaml
215
+ .base_depends_components: &base-depends-components
216
+ depends_components:
217
+ - esp_hw_support
218
+ - esp_rom
219
+ - esp_wifi
220
+
221
+ examples/wifi/coexist:
222
+ <<: *base-depends-components
223
+ depends_components+:
224
+ - esp_coex
225
+ depends_components-:
226
+ - esp_rom
227
+ ```
228
+
229
+ After interpretation, the resulting YAML will be:
230
+
231
+ ```yaml
232
+ examples/wifi/coexist:
233
+ depends_components:
234
+ - esp_hw_support
235
+ - esp_wifi
236
+ - esp_coex
237
+ ```
238
+
239
+ This means that the `esp_rom` element is removed, and the `esp_coex` element is added to the `depends_components` list.
240
+
241
+ #### Array Elements as Dictionaries
242
+
243
+ In addition to reuse elements from a list of strings, you can also perform these operations on a list of dictionaries. The matching is done based on the `if` key. Here's an example:
244
+
245
+ ```yaml
246
+ .base: &base
247
+ enable:
248
+ - if: IDF_VERSION == "5.2.0"
249
+ - if: IDF_VERSION == "5.3.0"
250
+
251
+ foo:
252
+ <<: *base
253
+ enable+:
254
+ # this if statement dictionary will override the one defined in `&base`
255
+ - if: IDF_VERSION == "5.2.0"
256
+ temp: true
257
+ - if: IDF_VERSION == "5.4.0"
258
+ reason: bar
259
+ ```
260
+
261
+ After interpretation, the resulting YAML will be:
262
+
263
+ ```yaml
264
+ foo:
265
+ enable:
266
+ - if: IDF_VERSION == "5.3.0"
267
+ - if: IDF_VERSION == "5.2.0"
268
+ temp: true
269
+ - if: IDF_VERSION == "5.4.0"
270
+ reason: bar
271
+ ```
272
+
273
+ In this case, the `enable` list is extended with the new `if` statement and `reason` dictionary.
274
+ It's important to note that the `if` dictionary defined in the `+` postfix will override the earlier one when the `if` statement matches.
275
+
276
+ This demonstrates how you can use the `+` and `-` postfixes to extend and remove elements from both string and dictionary lists in our YAML.
@@ -8,7 +8,7 @@ Tools for building ESP-IDF related apps.
8
8
  # ruff: noqa: E402
9
9
  # avoid circular imports
10
10
 
11
- __version__ = '2.1.1'
11
+ __version__ = '2.2.1'
12
12
 
13
13
  from .session_args import (
14
14
  SessionArgs,
@@ -36,8 +36,8 @@ __all__ = [
36
36
  'AppDeserializer',
37
37
  'CMakeApp',
38
38
  'MakeApp',
39
- 'find_apps',
40
39
  'build_apps',
40
+ 'find_apps',
41
41
  'json_to_app',
42
42
  'setup_logging',
43
43
  ]
@@ -88,7 +88,7 @@ class App(BaseModel):
88
88
  IDF_VERSION_PLACEHOLDER: t.ClassVar[str] = '@v' # replace it with the IDF version
89
89
  INDEX_PLACEHOLDER: t.ClassVar[str] = '@i' # replace it with the build index (while build_apps)
90
90
 
91
- SDKCONFIG_LINE_REGEX: t.ClassVar[t.Pattern] = re.compile(r"^([^=]+)=\"?([^\"\n]*)\"?\n*$")
91
+ SDKCONFIG_LINE_REGEX: t.ClassVar[t.Pattern] = re.compile(r'^([^=]+)=\"?([^\"\n]*)\"?\n*$')
92
92
 
93
93
  # could be assigned later, used for filtering out apps by supported_targets
94
94
  MANIFEST: t.ClassVar[t.Optional[Manifest]] = None
@@ -151,12 +151,10 @@ class App(BaseModel):
151
151
  size_json_filename: t.Optional[str] = None,
152
152
  **kwargs: t.Any,
153
153
  ) -> None:
154
- kwargs.update(
155
- {
156
- 'app_dir': app_dir,
157
- 'target': target,
158
- }
159
- )
154
+ kwargs.update({
155
+ 'app_dir': app_dir,
156
+ 'target': target,
157
+ })
160
158
  super().__init__(**kwargs)
161
159
 
162
160
  # These internal variables store the paths with environment variables and placeholders;
@@ -169,14 +167,12 @@ class App(BaseModel):
169
167
  self._is_build_log_path_temp = not bool(build_log_filename)
170
168
 
171
169
  # pass all parameters to initialize hook method
172
- kwargs.update(
173
- {
174
- 'work_dir': self._work_dir,
175
- 'build_dir': self._build_dir,
176
- 'build_log_filename': build_log_filename,
177
- 'size_json_filename': size_json_filename,
178
- }
179
- )
170
+ kwargs.update({
171
+ 'work_dir': self._work_dir,
172
+ 'build_dir': self._build_dir,
173
+ 'build_log_filename': build_log_filename,
174
+ 'size_json_filename': size_json_filename,
175
+ })
180
176
  self._kwargs = kwargs
181
177
  self._initialize_hook(**kwargs)
182
178
 
@@ -240,12 +236,10 @@ class App(BaseModel):
240
236
  return [DEFAULT_SDKCONFIG]
241
237
 
242
238
  @t.overload
243
- def _expand(self, path: None) -> None:
244
- ...
239
+ def _expand(self, path: None) -> None: ...
245
240
 
246
241
  @t.overload
247
- def _expand(self, path: str) -> str:
248
- ...
242
+ def _expand(self, path: str) -> str: ...
249
243
 
250
244
  def _expand(self, path):
251
245
  """
@@ -437,14 +431,18 @@ class App(BaseModel):
437
431
  @property
438
432
  def depends_components(self) -> t.List[str]:
439
433
  if self.MANIFEST:
440
- return self.MANIFEST.depends_components(self.app_dir)
434
+ return self.MANIFEST.depends_components(
435
+ self.app_dir, self.sdkconfig_files_defined_idf_target, self.config_name
436
+ )
441
437
 
442
438
  return []
443
439
 
444
440
  @property
445
441
  def depends_filepatterns(self) -> t.List[str]:
446
442
  if self.MANIFEST:
447
- return self.MANIFEST.depends_filepatterns(self.app_dir)
443
+ return self.MANIFEST.depends_filepatterns(
444
+ self.app_dir, self.sdkconfig_files_defined_idf_target, self.config_name
445
+ )
448
446
 
449
447
  return []
450
448
 
@@ -618,10 +616,10 @@ class App(BaseModel):
618
616
  def _build(
619
617
  self,
620
618
  *,
621
- manifest_rootpath: t.Optional[str] = None,
622
- modified_components: t.Optional[t.List[str]] = None,
623
- modified_files: t.Optional[t.List[str]] = None,
624
- check_app_dependencies: bool = False,
619
+ manifest_rootpath: t.Optional[str] = None, # noqa: ARG002
620
+ modified_components: t.Optional[t.List[str]] = None, # noqa: ARG002
621
+ modified_files: t.Optional[t.List[str]] = None, # noqa: ARG002
622
+ check_app_dependencies: bool = False, # noqa: ARG002
625
623
  ) -> None:
626
624
  self._build_stage = BuildStage.BUILD
627
625
 
@@ -654,14 +652,12 @@ class App(BaseModel):
654
652
  else:
655
653
  with open(self.size_json_path, 'w') as fw:
656
654
  subprocess_run(
657
- (
658
- [
659
- sys.executable,
660
- str(IDF_SIZE_PY),
661
- '--json',
662
- map_file,
663
- ]
664
- ),
655
+ ([
656
+ sys.executable,
657
+ str(IDF_SIZE_PY),
658
+ '--json',
659
+ map_file,
660
+ ]),
665
661
  log_terminal=False,
666
662
  log_fs=fw,
667
663
  check=True,
@@ -789,7 +785,7 @@ class MakeApp(App):
789
785
  if self.sdkconfig_files_defined_idf_target:
790
786
  return [self.sdkconfig_files_defined_idf_target]
791
787
 
792
- return ['esp8266'] + FolderRule.DEFAULT_BUILD_TARGETS
788
+ return ['esp8266', *FolderRule.DEFAULT_BUILD_TARGETS]
793
789
 
794
790
  def _build(
795
791
  self,
@@ -910,7 +906,7 @@ class CMakeApp(App):
910
906
 
911
907
  if modified_components is not None and check_app_dependencies and self.build_status == BuildStatus.UNKNOWN:
912
908
  subprocess_run(
913
- common_args + ['reconfigure'],
909
+ [*common_args, 'reconfigure'],
914
910
  log_terminal=self._is_build_log_path_temp,
915
911
  log_fs=self.build_log_path,
916
912
  check=True,
@@ -0,0 +1,10 @@
1
+ # SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ from .report import (
5
+ TestCase,
6
+ TestReport,
7
+ TestSuite,
8
+ )
9
+
10
+ __all__ = ['TestCase', 'TestReport', 'TestSuite']
@@ -1,4 +1,4 @@
1
- # SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
1
+ # SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2
2
  # SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  """
@@ -39,7 +39,9 @@ import typing as t
39
39
  from datetime import (
40
40
  datetime,
41
41
  )
42
- from xml.etree import ElementTree as ET
42
+ from xml.etree import (
43
+ ElementTree,
44
+ )
43
45
  from xml.sax.saxutils import (
44
46
  escape,
45
47
  )
@@ -118,8 +120,8 @@ class TestCase:
118
120
  def is_error(self) -> bool:
119
121
  return self.error_reason is not None
120
122
 
121
- def to_xml_elem(self) -> ET.Element:
122
- elem = ET.Element(
123
+ def to_xml_elem(self) -> ElementTree.Element:
124
+ elem = ElementTree.Element(
123
125
  'testcase',
124
126
  {
125
127
  'name': self.name,
@@ -128,11 +130,11 @@ class TestCase:
128
130
  },
129
131
  )
130
132
  if self.error_reason:
131
- ET.SubElement(elem, 'error', {'message': escape(self.error_reason)})
133
+ ElementTree.SubElement(elem, 'error', {'message': escape(self.error_reason)})
132
134
  elif self.failure_reason:
133
- ET.SubElement(elem, 'failure', {'message': escape(self.failure_reason)})
135
+ ElementTree.SubElement(elem, 'failure', {'message': escape(self.failure_reason)})
134
136
  elif self.skipped_reason:
135
- ET.SubElement(elem, 'skipped', {'message': escape(self.skipped_reason)})
137
+ ElementTree.SubElement(elem, 'skipped', {'message': escape(self.skipped_reason)})
136
138
 
137
139
  if self.properties:
138
140
  for k, v in self.properties.items():
@@ -171,8 +173,8 @@ class TestSuite:
171
173
 
172
174
  self.duration_sec += test_case.duration_sec
173
175
 
174
- def to_xml_elem(self) -> ET.Element:
175
- elem = ET.Element(
176
+ def to_xml_elem(self) -> ElementTree.Element:
177
+ elem = ElementTree.Element(
176
178
  'testsuite',
177
179
  {
178
180
  'name': self.name,
@@ -199,10 +201,10 @@ class TestReport:
199
201
  self.filepath = filepath
200
202
 
201
203
  def create_test_report(self) -> None:
202
- xml = ET.Element('testsuites')
204
+ xml = ElementTree.Element('testsuites')
203
205
 
204
206
  for test_suite in self.test_suites:
205
207
  xml.append(test_suite.to_xml_elem())
206
208
 
207
- ET.ElementTree(xml).write(self.filepath, encoding='utf-8')
209
+ ElementTree.ElementTree(xml).write(self.filepath, encoding='utf-8')
208
210
  LOGGER.info('Test report written to %s', self.filepath)
@@ -1,4 +1,4 @@
1
- # SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
1
+ # SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2
2
  # SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import logging
@@ -51,7 +51,7 @@ class ColoredFormatter(logging.Formatter):
51
51
 
52
52
  if record.levelno in [logging.WARNING, logging.ERROR]:
53
53
  record.msg = '>>> ' + str(record.msg)
54
- elif record.levelno in [logging.CRITICAL]:
54
+ elif record.levelno == logging.CRITICAL:
55
55
  record.msg = '!!! ' + str(record.msg)
56
56
 
57
57
  formatter = logging.Formatter(log_fmt, datefmt=self.datefmt)
@@ -351,14 +351,12 @@ def build_apps(
351
351
  if os.path.isfile(app.size_json_path):
352
352
  with open(build_apps_args.collect_size_info, 'a') as fw:
353
353
  fw.write(
354
- json.dumps(
355
- {
356
- 'app_name': app.name,
357
- 'config_name': app.config_name,
358
- 'target': app.target,
359
- 'path': app.size_json_path,
360
- }
361
- )
354
+ json.dumps({
355
+ 'app_name': app.name,
356
+ 'config_name': app.config_name,
357
+ 'target': app.target,
358
+ 'path': app.size_json_path,
359
+ })
362
360
  + '\n'
363
361
  )
364
362
  LOGGER.debug('Recorded size info file path in %s', build_apps_args.collect_size_info)
@@ -488,7 +486,7 @@ def get_parser() -> argparse.ArgumentParser:
488
486
  type=str,
489
487
  help='The --override-sdkconfig-items option is a comma-separated list '
490
488
  'that permits the overriding of specific configuration items defined '
491
- 'in the SDK\'s sdkconfig file and Kconfig using a command-line argument. '
489
+ "in the SDK's sdkconfig file and Kconfig using a command-line argument. "
492
490
  'The sdkconfig items specified here override the same sdkconfig '
493
491
  'item defined in the --override-sdkconfig-files, if exists.',
494
492
  )
@@ -669,7 +667,7 @@ def validate_args(parser: argparse.ArgumentParser, args: argparse.Namespace) ->
669
667
  if not args.target:
670
668
  raise InvalidCommand(
671
669
  'Must specify current build target with CLI option "-t <target>" or "--target <target>". '
672
- '(choices: [{}]'.format(','.join(ALL_TARGETS + ['all']))
670
+ '(choices: [{}]'.format(','.join([*ALL_TARGETS, 'all']))
673
671
  )
674
672
 
675
673
  default_build_targets = []
@@ -677,8 +675,8 @@ def validate_args(parser: argparse.ArgumentParser, args: argparse.Namespace) ->
677
675
  for target in args.default_build_targets:
678
676
  if target not in ALL_TARGETS:
679
677
  raise InvalidCommand(
680
- 'Unrecognizable target {} specified with "--default-build-targets". '
681
- 'Current ESP-IDF available targets: {}'.format(target, ALL_TARGETS)
678
+ f'Unrecognizable target {target} specified with "--default-build-targets". '
679
+ f'Current ESP-IDF available targets: {ALL_TARGETS}'
682
680
  )
683
681
 
684
682
  if target not in default_build_targets:
@@ -1,6 +1,7 @@
1
- # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
1
+ # SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2
2
  # SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import operator
4
5
  import os
5
6
  from ast import (
6
7
  literal_eval,
@@ -113,7 +114,7 @@ class Integer(Stmt):
113
114
  def __init__(self, t: ParseResults):
114
115
  self.expr: str = t[0]
115
116
 
116
- def get_value(self, target: str, config_name: str) -> Any:
117
+ def get_value(self, target: str, config_name: str) -> Any: # noqa: ARG002
117
118
  return literal_eval(self.expr)
118
119
 
119
120
 
@@ -121,7 +122,7 @@ class String(Stmt):
121
122
  def __init__(self, t: ParseResults):
122
123
  self.expr: str = t[0]
123
124
 
124
- def get_value(self, target: str, config_name: str) -> Any:
125
+ def get_value(self, target: str, config_name: str) -> Any: # noqa: ARG002
125
126
  return literal_eval(f'"{self.expr}"') # double quotes is swallowed by QuotedString
126
127
 
127
128
 
@@ -135,12 +136,12 @@ class List_(Stmt):
135
136
 
136
137
  class BoolStmt(Stmt):
137
138
  _OP_DICT = {
138
- '==': lambda x, y: x == y,
139
- '!=': lambda x, y: x != y,
140
- '>': lambda x, y: x > y,
141
- '>=': lambda x, y: x >= y,
142
- '<': lambda x, y: x < y,
143
- '<=': lambda x, y: x <= y,
139
+ '==': operator.eq,
140
+ '!=': operator.ne,
141
+ '>': operator.gt,
142
+ '>=': operator.ge,
143
+ '<': operator.lt,
144
+ '<=': operator.le,
144
145
  'not in': lambda x, y: x not in y,
145
146
  'in': lambda x, y: x in y,
146
147
  }