idf-build-apps 2.12.2__py3-none-any.whl → 2.13.0__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.12.2'
11
+ __version__ = '2.13.0'
12
12
 
13
13
  from .session_args import (
14
14
  SessionArgs,
idf_build_apps/app.py CHANGED
@@ -109,6 +109,7 @@ class App(BaseModel):
109
109
  build_status: BuildStatus = BuildStatus.UNKNOWN
110
110
  build_comment: t.Optional[str] = None
111
111
  test_comment: t.Optional[str] = None
112
+ checked_should_build: bool = False
112
113
 
113
114
  _build_duration: float = 0
114
115
  _build_timestamp: t.Optional[datetime] = None
@@ -116,6 +117,7 @@ class App(BaseModel):
116
117
  __EQ_IGNORE_FIELDS__ = [
117
118
  'build_comment',
118
119
  'test_comment',
120
+ 'checked_should_build',
119
121
  ]
120
122
  __EQ_TUNE_FIELDS__ = {
121
123
  'app_dir': lambda x: (os.path.realpath(os.path.expanduser(x))),
@@ -163,9 +165,6 @@ class App(BaseModel):
163
165
  self._kwargs = kwargs
164
166
  self._initialize_hook(**kwargs)
165
167
 
166
- # private attrs, won't be dumped to json
167
- self._checked_should_build = False
168
-
169
168
  self._sdkconfig_files, self._sdkconfig_files_defined_target = self._process_sdkconfig_files()
170
169
 
171
170
  @classmethod
@@ -750,12 +749,12 @@ class App(BaseModel):
750
749
  self.build_comment += '\n'.join(f'- {clause}' for clause in rule.enable)
751
750
 
752
751
  self.build_status = BuildStatus.DISABLED
753
- self._checked_should_build = True
752
+ self.checked_should_build = True
754
753
  return
755
754
 
756
755
  if not check_app_dependencies:
757
756
  self.build_status = BuildStatus.SHOULD_BE_BUILT
758
- self._checked_should_build = True
757
+ self.checked_should_build = True
759
758
  return
760
759
 
761
760
  if (
@@ -765,26 +764,26 @@ class App(BaseModel):
765
764
  ):
766
765
  self.build_status = BuildStatus.SHOULD_BE_BUILT
767
766
  self.build_comment = 'current build modifies the related manifest rules'
768
- self._checked_should_build = True
767
+ self.checked_should_build = True
769
768
  return
770
769
 
771
770
  if self.is_modified(modified_files):
772
771
  self.build_status = BuildStatus.SHOULD_BE_BUILT
773
772
  self.build_comment = 'current build modifies this app'
774
- self._checked_should_build = True
773
+ self.checked_should_build = True
775
774
  return
776
775
 
777
776
  # if didn't modify any components, and no `depends_filepatterns` defined, skip
778
777
  if modified_components == [] and not self.depends_filepatterns:
779
778
  self.build_status = BuildStatus.SKIPPED
780
779
  self.build_comment = 'current build does not modify any components'
781
- self._checked_should_build = True
780
+ self.checked_should_build = True
782
781
  return
783
782
 
784
783
  # if no special rules defined, we left it unknown and decide with idf.py reconfigure
785
784
  if not self.depends_components and not self.depends_filepatterns:
786
785
  # keep unknown
787
- self._checked_should_build = True
786
+ self.checked_should_build = True
788
787
  self.build_comment = 'no special rules defined, run idf.py reconfigure to decide'
789
788
  return
790
789
 
@@ -795,7 +794,7 @@ class App(BaseModel):
795
794
  # depends components?
796
795
  if self.depends_components and modified_components is not None:
797
796
  if set(self.depends_components).intersection(set(modified_components)):
798
- self._checked_should_build = True
797
+ self.checked_should_build = True
799
798
  self.build_status = BuildStatus.SHOULD_BE_BUILT
800
799
  self.build_comment = (
801
800
  f'Requires components: {", ".join(self.depends_components)}. '
@@ -806,7 +805,7 @@ class App(BaseModel):
806
805
  # or depends file patterns?
807
806
  if self.depends_filepatterns and modified_files is not None:
808
807
  if files_matches_patterns(modified_files, self.depends_filepatterns, manifest_rootpath):
809
- self._checked_should_build = True
808
+ self.checked_should_build = True
810
809
  self.build_status = BuildStatus.SHOULD_BE_BUILT
811
810
  self.build_comment = (
812
811
  f'Requires file patterns: {", ".join(self.depends_filepatterns)}. '
@@ -817,7 +816,7 @@ class App(BaseModel):
817
816
  # special rules defined, but not matched
818
817
  self.build_status = BuildStatus.SKIPPED
819
818
  self.build_comment = 'current build does not modify any components or files required by this app'
820
- self._checked_should_build = True
819
+ self.checked_should_build = True
821
820
 
822
821
  def check_should_test(self) -> None:
823
822
  """Check if testing is disabled for this app and set test_disable_reason."""
@@ -955,7 +954,7 @@ class CMakeApp(App):
955
954
  check_app_dependencies=check_app_dependencies,
956
955
  )
957
956
 
958
- if not self._checked_should_build:
957
+ if not self.checked_should_build:
959
958
  self.check_should_build(
960
959
  manifest_rootpath=manifest_rootpath,
961
960
  modified_components=modified_components,
idf_build_apps/args.py CHANGED
@@ -29,7 +29,7 @@ from pydantic_settings import (
29
29
  from typing_extensions import Concatenate, ParamSpec
30
30
 
31
31
  from . import SESSION_ARGS, App, CMakeApp, MakeApp, setup_logging
32
- from .constants import ALL_TARGETS, IDF_BUILD_APPS_TOML_FN
32
+ from .constants import ALL_TARGETS, IDF_BUILD_APPS_TOML_FN, PREVIEW_TARGETS, SUPPORTED_TARGETS
33
33
  from .manifest.manifest import DEFAULT_BUILD_TARGETS, Manifest, reset_default_build_targets
34
34
  from .utils import InvalidCommand, files_matches_patterns, semicolon_separated_str_to_list, to_absolute_path, to_list
35
35
  from .vendors.pydantic_sources import PyprojectTomlConfigSettingsSource, TomlConfigSettingsSource
@@ -563,17 +563,22 @@ class FindBuildArguments(DependencyDrivenBuildArguments):
563
563
  nargs='+',
564
564
  ),
565
565
  description='space-separated list of the default enabled build targets for the apps. '
566
- 'When not specified, the default value is the targets listed by `idf.py --list-targets`. '
567
- 'Cannot be used together with --enable-preview-targets',
566
+ 'When not specified, the default value is the targets listed by `idf.py --list-targets`.',
567
+ default=None, # type: ignore
568
+ )
569
+ additional_build_targets: t.Optional[t.List[str]] = field(
570
+ FieldMetadata(
571
+ validate_method=[ValidateMethod.TO_LIST],
572
+ nargs='+',
573
+ ),
574
+ description='space-separated list of additional build targets to add to the default enabled build targets',
568
575
  default=None, # type: ignore
569
576
  )
570
577
  enable_preview_targets: bool = field(
571
578
  FieldMetadata(
572
579
  action='store_true',
573
580
  ),
574
- description='When enabled, all targets will be enabled by default, '
575
- 'including the preview targets. As the targets defined in `idf.py --list-targets --preview`. '
576
- 'Cannot be used together with --default-build-targets',
581
+ description='When enabled, PREVIEW_TARGETS will be added to the default enabled build targets',
577
582
  default=False, # type: ignore
578
583
  )
579
584
  disable_targets: t.Optional[t.List[str]] = field(
@@ -616,39 +621,44 @@ class FindBuildArguments(DependencyDrivenBuildArguments):
616
621
  LOGGER.debug('--target is missing. Set --target as "all".')
617
622
  self.target = 'all'
618
623
 
619
- # Validate mutual exclusivity of enable_preview_targets and default_build_targets
620
- if self.enable_preview_targets and self.default_build_targets:
621
- raise InvalidCommand(
622
- 'Cannot specify both --enable-preview-targets and --default-build-targets at the same time. '
623
- 'Please use only one of these options.'
624
- )
625
-
626
624
  reset_default_build_targets() # reset first then judge again
625
+
626
+ # Build the target set by combining the options
627
+ default_build_targets: t.List[str] = []
628
+ # Step 1: Determine base targets
627
629
  if self.default_build_targets:
628
- default_build_targets = []
629
- for target in self.default_build_targets:
630
- if target not in ALL_TARGETS:
631
- LOGGER.warning(
632
- f'Ignoring... Unrecognizable target {target} specified with "--default-build-targets". '
633
- f'Current ESP-IDF available targets: {ALL_TARGETS}'
634
- )
635
- elif target not in default_build_targets:
636
- default_build_targets.append(target)
637
- self.default_build_targets = default_build_targets
638
- LOGGER.info('Overriding default build targets to %s', self.default_build_targets)
639
- DEFAULT_BUILD_TARGETS.set(self.default_build_targets)
640
- elif self.enable_preview_targets:
641
- self.default_build_targets = deepcopy(ALL_TARGETS)
642
- LOGGER.info('Overriding default build targets to %s', self.default_build_targets)
643
- DEFAULT_BUILD_TARGETS.set(self.default_build_targets)
644
-
645
- if self.disable_targets and DEFAULT_BUILD_TARGETS.get():
646
- LOGGER.info('Disable targets: %s', self.disable_targets)
647
- self.default_build_targets = [
648
- _target for _target in DEFAULT_BUILD_TARGETS.get() if _target not in self.disable_targets
649
- ]
650
- DEFAULT_BUILD_TARGETS.set(self.default_build_targets)
630
+ LOGGER.info('--default-build-targets is set, using `%s`', self.default_build_targets)
631
+ default_build_targets = deepcopy(self.default_build_targets)
632
+ elif SUPPORTED_TARGETS:
633
+ LOGGER.info('Using default SUPPORTED_TARGETS: %s', SUPPORTED_TARGETS)
634
+ default_build_targets = deepcopy(SUPPORTED_TARGETS)
635
+
636
+ if self.enable_preview_targets:
637
+ LOGGER.info('--enable-preview-targets is set, adding preview targets `%s`', PREVIEW_TARGETS)
638
+ default_build_targets.extend(PREVIEW_TARGETS)
639
+
640
+ if self.additional_build_targets:
641
+ LOGGER.info('--additional-build-targets is set, adding `%s`', self.additional_build_targets)
642
+ default_build_targets.extend(self.additional_build_targets)
643
+
644
+ res = []
645
+ for _t in set(default_build_targets):
646
+ if _t not in ALL_TARGETS:
647
+ LOGGER.warning(
648
+ f'Ignoring... Unrecognizable target {_t} specified. '
649
+ f'Current ESP-IDF available targets: {ALL_TARGETS}'
650
+ )
651
+ continue
652
+
653
+ if self.disable_targets and _t in self.disable_targets:
654
+ LOGGER.info(f'Ignoring... Target {_t} is in the disabled targets list.')
655
+ continue
656
+
657
+ res.append(_t)
658
+ self.default_build_targets = sorted(res)
659
+ DEFAULT_BUILD_TARGETS.set(self.default_build_targets)
651
660
 
661
+ # Override sdkconfig files/items
652
662
  if self.override_sdkconfig_files or self.override_sdkconfig_items:
653
663
  SESSION_ARGS.set(self)
654
664
 
idf_build_apps/finder.py CHANGED
@@ -16,6 +16,7 @@ from .app import (
16
16
  )
17
17
  from .args import FindArguments
18
18
  from .constants import (
19
+ ALL_TARGETS,
19
20
  BuildStatus,
20
21
  )
21
22
  from .utils import (
@@ -26,6 +27,14 @@ from .utils import (
26
27
  LOGGER = logging.getLogger(__name__)
27
28
 
28
29
 
30
+ def _is_target_specific(filepath: str) -> bool:
31
+ for target in ALL_TARGETS:
32
+ if filepath.endswith(f'.{target}'):
33
+ return True
34
+
35
+ return False
36
+
37
+
29
38
  def _get_apps_from_path(
30
39
  path: str,
31
40
  target: str,
@@ -55,8 +64,8 @@ def _get_apps_from_path(
55
64
  sdkconfig_paths_matched = True # skip the next block for no wildcard config rules
56
65
 
57
66
  for sdkconfig_path in sdkconfig_paths:
58
- if sdkconfig_path.endswith(f'.{target}'):
59
- LOGGER.debug('=> Skipping sdkconfig %s which is target-specific', sdkconfig_path)
67
+ if _is_target_specific(sdkconfig_path):
68
+ LOGGER.debug('=> Skipping sdkconfig file `%s` which is target-specific', sdkconfig_path)
60
69
  continue
61
70
 
62
71
  # Figure out the config name
idf_build_apps/utils.py CHANGED
@@ -386,6 +386,9 @@ class BaseModel(_BaseModel):
386
386
  hash_list = []
387
387
 
388
388
  self_model_dump = self.model_dump()
389
+ for _field in self.__EQ_IGNORE_FIELDS__:
390
+ self_model_dump.pop(_field, None)
391
+
389
392
  for _field in self.__EQ_TUNE_FIELDS__:
390
393
  self_model_dump[_field] = self.__EQ_TUNE_FIELDS__[_field](self_model_dump[_field])
391
394
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: idf-build-apps
3
- Version: 2.12.2
3
+ Version: 2.13.0
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,15 +1,15 @@
1
- idf_build_apps/__init__.py,sha256=h7XcljanhI0hCRrQs8Xc9lKiiXKDh2hwt8vTD6Lwbv4,711
1
+ idf_build_apps/__init__.py,sha256=NMlLrPIwkNau5FvVguRJyW_C8qIaidZce8hpmlQXkhE,711
2
2
  idf_build_apps/__main__.py,sha256=pT6OsFQRjCw39Jg43HAeGKzq8h5E_0m7kHDE2QMqDe0,182
3
- idf_build_apps/app.py,sha256=QXNfn5HVgkjLR6Xswa-wdy3BEWgJJ1k0Zn2-Q9NC92I,39181
4
- idf_build_apps/args.py,sha256=m1tJl75P3yuDIaxQpg4bL8UIe2j_R1tNvQW_vpyR1AU,40099
3
+ idf_build_apps/app.py,sha256=9TeFeQnvqETtmLV9v3mQzXmkJA1F3e8l_16MkCRhBT4,39149
4
+ idf_build_apps/args.py,sha256=e9d4kxv2q7SEOF42rWn-GS9EfIYYLaMxNUagJ8SPGzk,40140
5
5
  idf_build_apps/autocompletions.py,sha256=2fZQxzgZ21ie_2uk-B-7-xWYCChfOSgRFRYb7I2Onfo,2143
6
6
  idf_build_apps/constants.py,sha256=2iwLPZRhSQcn1v4RAcOJnHbqp1fDTp6A1gHaxn5ciTE,2166
7
- idf_build_apps/finder.py,sha256=gpOcpGrzAGiBVRCgKQ_YW22_OUJv-D-hMApuE-tPhVQ,5644
7
+ idf_build_apps/finder.py,sha256=CKppfxa-nPedHKXfyQ841q1DZc0BimVulXK52EfCD0o,5833
8
8
  idf_build_apps/log.py,sha256=15sSQhv9dJsHShDR2KgFGFp8ByjV0HogLr1X1lHYqGs,3899
9
9
  idf_build_apps/main.py,sha256=P_TsUA2s048qcRb-wVngF-zqNjH_NEYrQsAYKB1GHmU,17960
10
10
  idf_build_apps/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  idf_build_apps/session_args.py,sha256=1B7e3M9_eKdQezGNXaocqCq7iE4MOxpYJkfanCfdkDE,2973
12
- idf_build_apps/utils.py,sha256=cQJ5N-53vrASa4d8WW0AQCPJzendArXyU3kB5Vx-AH8,10880
12
+ idf_build_apps/utils.py,sha256=YJZOXIpo3aoRkGZJoQUJHAPWi2VkTDAVzQG5DI2igxw,10976
13
13
  idf_build_apps/junit/__init__.py,sha256=ljILW1rfeBAIlwZIw8jstYrVbugErlmCYzSzJwNFC2I,231
14
14
  idf_build_apps/junit/report.py,sha256=yzt5SiJEA_AUlw2Ld23J7enYlfDluvmKAcCnAM8ccqE,6565
15
15
  idf_build_apps/junit/utils.py,sha256=idBrLgsz6Co2QUQqq1AiyzRHnqbJf_EoykEAxCkjHZw,1303
@@ -20,8 +20,8 @@ idf_build_apps/vendors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
20
20
  idf_build_apps/vendors/pydantic_sources.py,sha256=cxSIPRc3eI5peVMhDxwf58YaGhuG4SCwPRVX2znFEek,4553
21
21
  idf_build_apps/yaml/__init__.py,sha256=R6pYasVsD31maeZ4dWRZnS10hwzM7gXdnfzDsOIRJ-4,167
22
22
  idf_build_apps/yaml/parser.py,sha256=IhY7rCWXOxrzzgEiKipTdPs_8yXDf8JZr-sMewV1pk8,2133
23
- idf_build_apps-2.12.2.dist-info/entry_points.txt,sha256=3pVUirUEsb6jsDRikkQWNUt4hqLK2ci1HvW_Vf8b6uE,59
24
- idf_build_apps-2.12.2.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
25
- idf_build_apps-2.12.2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
26
- idf_build_apps-2.12.2.dist-info/METADATA,sha256=vdzZqBwn3IGTFgVaKPD39ofId6UfAbvdNAZVDgyx4FQ,4795
27
- idf_build_apps-2.12.2.dist-info/RECORD,,
23
+ idf_build_apps-2.13.0.dist-info/entry_points.txt,sha256=3pVUirUEsb6jsDRikkQWNUt4hqLK2ci1HvW_Vf8b6uE,59
24
+ idf_build_apps-2.13.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
25
+ idf_build_apps-2.13.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
26
+ idf_build_apps-2.13.0.dist-info/METADATA,sha256=yMOaaLlxZVkHHPhQjVHnaQRCtE4z0uTb_3DzIpTovFc,4795
27
+ idf_build_apps-2.13.0.dist-info/RECORD,,