idf-build-apps 2.2.2__py3-none-any.whl → 2.3.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.
@@ -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.2.2'
11
+ __version__ = '2.3.1'
12
12
 
13
13
  from .session_args import (
14
14
  SessionArgs,
idf_build_apps/app.py CHANGED
@@ -124,6 +124,7 @@ class App(BaseModel):
124
124
  verbose: bool = False
125
125
  check_warnings: bool = False
126
126
  preserve: bool = True
127
+ copy_sdkconfig: bool = False
127
128
 
128
129
  # build_apps() related
129
130
  build_apps_args: t.Optional[BuildAppsArgs] = None
@@ -561,6 +562,17 @@ class App(BaseModel):
561
562
  def _post_build(self) -> None:
562
563
  self._build_stage = BuildStage.POST_BUILD
563
564
 
565
+ if self.copy_sdkconfig:
566
+ try:
567
+ shutil.copy(
568
+ os.path.join(self.work_dir, 'sdkconfig'),
569
+ os.path.join(self.build_path, 'sdkconfig'),
570
+ )
571
+ except Exception as e:
572
+ self._logger.warning('Copy sdkconfig file from failed: %s', e)
573
+ else:
574
+ self._logger.debug('Copied sdkconfig file from %s to %s', self.work_dir, self.build_path)
575
+
564
576
  if not os.path.isfile(self.build_log_path):
565
577
  return
566
578
 
idf_build_apps/main.py CHANGED
@@ -6,7 +6,6 @@ import json
6
6
  import logging
7
7
  import os
8
8
  import re
9
- import shutil
10
9
  import sys
11
10
  import textwrap
12
11
  import typing as t
@@ -66,12 +65,26 @@ def _check_app_dependency(
66
65
  manifest_rootpath: t.Optional[str] = None,
67
66
  modified_components: t.Optional[t.List[str]] = None,
68
67
  modified_files: t.Optional[t.List[str]] = None,
68
+ ignore_app_dependencies_components: t.Optional[t.List[str]] = None,
69
69
  ignore_app_dependencies_filepatterns: t.Optional[t.List[str]] = None,
70
70
  ) -> bool:
71
71
  # not check since modified_components and modified_files are not passed
72
72
  if modified_components is None and modified_files is None:
73
73
  return False
74
74
 
75
+ # not check since ignore_app_dependencies_components is passed and matched
76
+ if (
77
+ ignore_app_dependencies_components
78
+ and modified_components is not None
79
+ and set(modified_components).intersection(ignore_app_dependencies_components)
80
+ ):
81
+ LOGGER.info(
82
+ 'Build all apps since modified components %s matches ignored components %s',
83
+ ', '.join(modified_components),
84
+ ', '.join(ignore_app_dependencies_components),
85
+ )
86
+ return False
87
+
75
88
  # not check since ignore_app_dependencies_filepatterns is passed and matched
76
89
  if (
77
90
  ignore_app_dependencies_filepatterns
@@ -79,7 +92,7 @@ def _check_app_dependency(
79
92
  and files_matches_patterns(modified_files, ignore_app_dependencies_filepatterns, manifest_rootpath)
80
93
  ):
81
94
  LOGGER.info(
82
- 'Build all apps since patterns %s matches modified files %s',
95
+ 'Build all apps since modified files %s matches ignored file patterns %s',
83
96
  ', '.join(modified_files),
84
97
  ', '.join(ignore_app_dependencies_filepatterns),
85
98
  )
@@ -108,6 +121,7 @@ def find_apps(
108
121
  default_build_targets: t.Optional[t.Union[t.List[str], str]] = None,
109
122
  modified_components: t.Optional[t.Union[t.List[str], str]] = None,
110
123
  modified_files: t.Optional[t.Union[t.List[str], str]] = None,
124
+ ignore_app_dependencies_components: t.Optional[t.Union[t.List[str], str]] = None,
111
125
  ignore_app_dependencies_filepatterns: t.Optional[t.Union[t.List[str], str]] = None,
112
126
  sdkconfig_defaults: t.Optional[str] = None,
113
127
  include_skipped_apps: bool = False,
@@ -137,8 +151,8 @@ def find_apps(
137
151
  :param default_build_targets: default build targets used in manifest files
138
152
  :param modified_components: modified components
139
153
  :param modified_files: modified files
140
- :param ignore_app_dependencies_filepatterns: file patterns that used for ignoring checking the component
141
- dependencies
154
+ :param ignore_app_dependencies_components: components used for ignoring checking the app dependencies
155
+ :param ignore_app_dependencies_filepatterns: file patterns used for ignoring checking the app dependencies
142
156
  :param sdkconfig_defaults: semicolon-separated string, pass to idf.py -DSDKCONFIG_DEFAULTS if specified,
143
157
  also could be set via environment variables "SDKCONFIG_DEFAULTS"
144
158
  :param include_skipped_apps: include skipped apps or not
@@ -168,6 +182,7 @@ def find_apps(
168
182
 
169
183
  modified_components = to_list(modified_components)
170
184
  modified_files = to_list(modified_files)
185
+ ignore_app_dependencies_components = to_list(ignore_app_dependencies_components)
171
186
  ignore_app_dependencies_filepatterns = to_list(ignore_app_dependencies_filepatterns)
172
187
  config_rules_str = to_list(config_rules_str)
173
188
 
@@ -199,6 +214,7 @@ def find_apps(
199
214
  manifest_rootpath=manifest_rootpath,
200
215
  modified_components=modified_components,
201
216
  modified_files=modified_files,
217
+ ignore_app_dependencies_components=ignore_app_dependencies_components,
202
218
  ignore_app_dependencies_filepatterns=ignore_app_dependencies_filepatterns,
203
219
  ),
204
220
  modified_components=modified_components,
@@ -225,6 +241,7 @@ def build_apps(
225
241
  manifest_rootpath: t.Optional[str] = None,
226
242
  modified_components: t.Optional[t.Union[t.List[str], str]] = None,
227
243
  modified_files: t.Optional[t.Union[t.List[str], str]] = None,
244
+ ignore_app_dependencies_components: t.Optional[t.Union[t.List[str], str]] = None,
228
245
  ignore_app_dependencies_filepatterns: t.Optional[t.Union[t.List[str], str]] = None,
229
246
  check_app_dependencies: t.Optional[bool] = None,
230
247
  # BuildAppsArgs
@@ -249,8 +266,8 @@ def build_apps(
249
266
  are relative paths. Use the current directory if not specified
250
267
  :param modified_components: modified components
251
268
  :param modified_files: modified files
252
- :param ignore_app_dependencies_filepatterns: file patterns that used for ignoring checking the component
253
- dependencies
269
+ :param ignore_app_dependencies_components: components used for ignoring checking the app dependencies
270
+ :param ignore_app_dependencies_filepatterns: file patterns used for ignoring checking the app dependencies
254
271
  :param check_app_dependencies: check app dependencies or not. if not set, will be calculated by modified_components,
255
272
  modified_files, and ignore_app_dependencies_filepatterns
256
273
  :param parallel_count: number of parallel tasks to run
@@ -263,6 +280,7 @@ def build_apps(
263
280
  apps = to_list(apps)
264
281
  modified_components = to_list(modified_components)
265
282
  modified_files = to_list(modified_files)
283
+ ignore_app_dependencies_components = to_list(ignore_app_dependencies_components)
266
284
  ignore_app_dependencies_filepatterns = to_list(ignore_app_dependencies_filepatterns)
267
285
 
268
286
  test_suite = TestSuite('build_apps')
@@ -305,6 +323,7 @@ def build_apps(
305
323
  app.dry_run = dry_run
306
324
  app.index = index
307
325
  app.verbose = build_verbose
326
+ app.copy_sdkconfig = copy_sdkconfig
308
327
 
309
328
  LOGGER.info('(%s/%s) Building app: %s', index, len(apps), app)
310
329
 
@@ -313,7 +332,11 @@ def build_apps(
313
332
  modified_components=modified_components,
314
333
  modified_files=modified_files,
315
334
  check_app_dependencies=_check_app_dependency(
316
- manifest_rootpath, modified_components, modified_files, ignore_app_dependencies_filepatterns
335
+ manifest_rootpath=manifest_rootpath,
336
+ modified_components=modified_components,
337
+ modified_files=modified_files,
338
+ ignore_app_dependencies_components=ignore_app_dependencies_components,
339
+ ignore_app_dependencies_filepatterns=ignore_app_dependencies_filepatterns,
317
340
  )
318
341
  if check_app_dependencies is None
319
342
  else check_app_dependencies,
@@ -330,17 +353,6 @@ def build_apps(
330
353
  fw.write(app.to_json() + '\n')
331
354
  LOGGER.debug('Recorded app info in %s', build_apps_args.collect_app_info)
332
355
 
333
- if copy_sdkconfig:
334
- try:
335
- shutil.copy(
336
- os.path.join(app.work_dir, 'sdkconfig'),
337
- os.path.join(app.build_path, 'sdkconfig'),
338
- )
339
- except Exception as e:
340
- LOGGER.warning('Copy sdkconfig file from failed: %s', e)
341
- else:
342
- LOGGER.debug('Copied sdkconfig file from %s to %s', app.work_dir, app.build_path)
343
-
344
356
  if app.build_status == BuildStatus.FAILED:
345
357
  if not keep_going:
346
358
  return 1
@@ -563,6 +575,18 @@ def get_parser() -> argparse.ArgumentParser:
563
575
  'If set to "", the value would be considered as None. '
564
576
  'If set to ";", the value would be considered as an empty list',
565
577
  )
578
+ common_args.add_argument(
579
+ '-ic',
580
+ '--ignore-app-dependencies-components',
581
+ type=semicolon_separated_str_to_list,
582
+ help='semicolon-separated string which specifies the modified components used for '
583
+ 'ignoring checking the app dependencies. '
584
+ 'The `depends_components` and `depends_filepatterns` set in the manifest files will be ignored when any of the '
585
+ 'specified components matches any of the modified components. '
586
+ 'Must be used together with --modified-components. '
587
+ 'If set to "", the value would be considered as None. '
588
+ 'If set to ";", the value would be considered as an empty list',
589
+ )
566
590
  common_args.add_argument(
567
591
  '-if',
568
592
  '--ignore-app-dependencies-filepatterns',
@@ -683,11 +707,13 @@ def validate_args(parser: argparse.ArgumentParser, args: argparse.Namespace) ->
683
707
  default_build_targets.append(target)
684
708
  args.default_build_targets = default_build_targets
685
709
 
710
+ if args.ignore_app_dependencies_components is not None:
711
+ if args.modified_components is None:
712
+ raise InvalidCommand('Must specify "--ignore-app-dependencies-components" with "--modified-components", ')
713
+
686
714
  if args.ignore_app_dependencies_filepatterns is not None:
687
715
  if args.modified_files is None:
688
- raise InvalidCommand(
689
- 'Must specify "--ignore-component-dependencies-file-patterns" with "--modified-files", '
690
- )
716
+ raise InvalidCommand('Must specify "--ignore-app-dependencies-filepatterns" with "--modified-files", ')
691
717
 
692
718
 
693
719
  def apply_config_args(args: argparse.Namespace) -> None:
@@ -731,6 +757,7 @@ def main():
731
757
  default_build_targets=args.default_build_targets,
732
758
  modified_components=args.modified_components,
733
759
  modified_files=args.modified_files,
760
+ ignore_app_dependencies_components=args.ignore_app_dependencies_components,
734
761
  ignore_app_dependencies_filepatterns=args.ignore_app_dependencies_filepatterns,
735
762
  sdkconfig_defaults=args.sdkconfig_defaults,
736
763
  )
@@ -766,6 +793,7 @@ def main():
766
793
  manifest_rootpath=args.manifest_rootpath,
767
794
  modified_components=args.modified_components,
768
795
  modified_files=args.modified_files,
796
+ ignore_app_dependencies_components=args.ignore_app_dependencies_components,
769
797
  ignore_app_dependencies_filepatterns=args.ignore_app_dependencies_filepatterns,
770
798
  junitxml=args.junitxml,
771
799
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: idf-build-apps
3
- Version: 2.2.2
3
+ Version: 2.3.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,12 +1,12 @@
1
- idf_build_apps/__init__.py,sha256=g7KWhbzxhtPjvHFxxiheaZzo6QmwQtOwWW_-u_QtwgE,650
1
+ idf_build_apps/__init__.py,sha256=z1ITg-Ywq6Ena0ioI98C9E6iK4aFe--1PiSFX-iUHl4,650
2
2
  idf_build_apps/__main__.py,sha256=8E-5xHm2MlRun0L88XJleNh5U50dpE0Q1nK5KqomA7I,182
3
- idf_build_apps/app.py,sha256=vThFVR70Oleddt_nTVmO-3VBJLMrm5NmoZbC48zolTo,35393
3
+ idf_build_apps/app.py,sha256=z6i55q_XaMjea34_nbAKgNTU-qOEkO_qTHCYSeQNUFw,35887
4
4
  idf_build_apps/build_apps_args.py,sha256=r6VCJDdCzE873X8OTputYkCBZPgECaKoNlAejfcamJk,1644
5
5
  idf_build_apps/config.py,sha256=I75uOQGarCWVKGi16ZYpo0qTVU25BUP4eh6-RWCtbvw,2924
6
6
  idf_build_apps/constants.py,sha256=xqclwUpWE5dEByL4kxdg2HaHjbAfkJtxodFfLZuAk8A,2818
7
7
  idf_build_apps/finder.py,sha256=qw5moNq7U5mHSsR0CCfGkKE9p4QsWYNcfkxzeQ73HgM,6252
8
8
  idf_build_apps/log.py,sha256=JysogBHoompfW9E9w0U4wZH7tt8dBdfoh-stPXQz1hw,2573
9
- idf_build_apps/main.py,sha256=jeQeNUiQoC1g5pS5vPpzfOpHCX7amdOqWpfp4BZjmac,32591
9
+ idf_build_apps/main.py,sha256=lP2rUqtBfU7gxN63owZlAshdXvSFUfElfTsKthhBQus,34651
10
10
  idf_build_apps/session_args.py,sha256=2WDTy40IFAc0KQ57HaeBcYj_k10eUXRKkDOWLrFCaHY,2985
11
11
  idf_build_apps/utils.py,sha256=n9PNJEDDsA9hbbM0SNPdTFsO2_E8alNrX7CNYzaFHik,9644
12
12
  idf_build_apps/junit/__init__.py,sha256=IxvdaS6eSXp7kZxRuXqyZyGxuA_A1nOW1jF1HMi8Gns,231
@@ -18,8 +18,8 @@ idf_build_apps/manifest/manifest.py,sha256=P5ZaUd72A_HOVF6iuwap__Bw-w7WI72ugiTUR
18
18
  idf_build_apps/manifest/soc_header.py,sha256=ULLad1TI8mGfdJhB7LJ4T9A_8BugF1TmckgdO7jO7Fg,3956
19
19
  idf_build_apps/yaml/__init__.py,sha256=W-3z5no07RQ6eYKGyOAPA8Z2CLiMPob8DD91I4URjrA,162
20
20
  idf_build_apps/yaml/parser.py,sha256=Y2OyB4g1DCC7C7jrvpIyZV9lgeCB_XvuB75iGmqiTaM,2093
21
- idf_build_apps-2.2.2.dist-info/entry_points.txt,sha256=3pVUirUEsb6jsDRikkQWNUt4hqLK2ci1HvW_Vf8b6uE,59
22
- idf_build_apps-2.2.2.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
23
- idf_build_apps-2.2.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
24
- idf_build_apps-2.2.2.dist-info/METADATA,sha256=P8i_S7bXUBZquAMN0N90TN8wBQEC4mZ4IpDywZwTQ1I,4458
25
- idf_build_apps-2.2.2.dist-info/RECORD,,
21
+ idf_build_apps-2.3.1.dist-info/entry_points.txt,sha256=3pVUirUEsb6jsDRikkQWNUt4hqLK2ci1HvW_Vf8b6uE,59
22
+ idf_build_apps-2.3.1.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
23
+ idf_build_apps-2.3.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
24
+ idf_build_apps-2.3.1.dist-info/METADATA,sha256=ET5FxoKnaafQWJGkpERufP1p7J_JLzz3gO3ZYLsRPVg,4458
25
+ idf_build_apps-2.3.1.dist-info/RECORD,,