idf-build-apps 2.4.2__py3-none-any.whl → 2.5.0rc0__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.
- idf_build_apps/__init__.py +1 -1
- idf_build_apps/app.py +35 -27
- idf_build_apps/args.py +965 -0
- idf_build_apps/config.py +19 -2
- idf_build_apps/constants.py +17 -28
- idf_build_apps/finder.py +34 -54
- idf_build_apps/log.py +2 -0
- idf_build_apps/main.py +117 -625
- idf_build_apps/manifest/manifest.py +112 -24
- idf_build_apps/utils.py +22 -0
- {idf_build_apps-2.4.2.dist-info → idf_build_apps-2.5.0rc0.dist-info}/METADATA +3 -4
- idf_build_apps-2.5.0rc0.dist-info/RECORD +26 -0
- idf_build_apps/build_apps_args.py +0 -64
- idf_build_apps-2.4.2.dist-info/RECORD +0 -26
- {idf_build_apps-2.4.2.dist-info → idf_build_apps-2.5.0rc0.dist-info}/LICENSE +0 -0
- {idf_build_apps-2.4.2.dist-info → idf_build_apps-2.5.0rc0.dist-info}/WHEEL +0 -0
- {idf_build_apps-2.4.2.dist-info → idf_build_apps-2.5.0rc0.dist-info}/entry_points.txt +0 -0
idf_build_apps/__init__.py
CHANGED
idf_build_apps/app.py
CHANGED
|
@@ -26,9 +26,6 @@ from pydantic import (
|
|
|
26
26
|
from . import (
|
|
27
27
|
SESSION_ARGS,
|
|
28
28
|
)
|
|
29
|
-
from .build_apps_args import (
|
|
30
|
-
BuildAppsArgs,
|
|
31
|
-
)
|
|
32
29
|
from .constants import (
|
|
33
30
|
DEFAULT_SDKCONFIG,
|
|
34
31
|
IDF_PY,
|
|
@@ -49,6 +46,7 @@ from .manifest.manifest import (
|
|
|
49
46
|
from .utils import (
|
|
50
47
|
BaseModel,
|
|
51
48
|
BuildError,
|
|
49
|
+
Literal,
|
|
52
50
|
files_matches_patterns,
|
|
53
51
|
find_first_match,
|
|
54
52
|
rmdir,
|
|
@@ -57,15 +55,6 @@ from .utils import (
|
|
|
57
55
|
to_list,
|
|
58
56
|
)
|
|
59
57
|
|
|
60
|
-
if sys.version_info < (3, 8):
|
|
61
|
-
from typing_extensions import (
|
|
62
|
-
Literal,
|
|
63
|
-
)
|
|
64
|
-
else:
|
|
65
|
-
from typing import (
|
|
66
|
-
Literal,
|
|
67
|
-
)
|
|
68
|
-
|
|
69
58
|
|
|
70
59
|
class _AppBuildStageFilter(logging.Filter):
|
|
71
60
|
def __init__(self, *args, app, **kwargs):
|
|
@@ -85,6 +74,7 @@ class App(BaseModel):
|
|
|
85
74
|
NAME_PLACEHOLDER: t.ClassVar[str] = '@n' # replace it with self.name
|
|
86
75
|
FULL_NAME_PLACEHOLDER: t.ClassVar[str] = '@f' # replace it with escaped self.app_dir
|
|
87
76
|
IDF_VERSION_PLACEHOLDER: t.ClassVar[str] = '@v' # replace it with the IDF version
|
|
77
|
+
PARALLEL_INDEX_PLACEHOLDER: t.ClassVar[str] = '@p' # replace it with the parallel index
|
|
88
78
|
INDEX_PLACEHOLDER: t.ClassVar[str] = '@i' # replace it with the build index (while build_apps)
|
|
89
79
|
|
|
90
80
|
SDKCONFIG_LINE_REGEX: t.ClassVar[t.Pattern] = re.compile(r'^([^=]+)=\"?([^\"\n]*)\"?\n*$')
|
|
@@ -125,7 +115,7 @@ class App(BaseModel):
|
|
|
125
115
|
copy_sdkconfig: bool = False
|
|
126
116
|
|
|
127
117
|
# build_apps() related
|
|
128
|
-
|
|
118
|
+
parallel_index: t.Optional[int] = None # used for expand
|
|
129
119
|
index: t.Optional[int] = None
|
|
130
120
|
|
|
131
121
|
# build status related
|
|
@@ -254,8 +244,8 @@ class App(BaseModel):
|
|
|
254
244
|
|
|
255
245
|
if self.index is not None:
|
|
256
246
|
path = path.replace(self.INDEX_PLACEHOLDER, str(self.index))
|
|
257
|
-
if self.
|
|
258
|
-
path = self.
|
|
247
|
+
if self.parallel_index:
|
|
248
|
+
path = path.replace(self.PARALLEL_INDEX_PLACEHOLDER, str(self.parallel_index))
|
|
259
249
|
path = path.replace(
|
|
260
250
|
self.IDF_VERSION_PLACEHOLDER, f'{IDF_VERSION_MAJOR}_{IDF_VERSION_MINOR}_{IDF_VERSION_PATCH}'
|
|
261
251
|
)
|
|
@@ -320,7 +310,7 @@ class App(BaseModel):
|
|
|
320
310
|
return os.path.join(self.build_path, self.build_log_filename)
|
|
321
311
|
|
|
322
312
|
# use a temp file if build log path is not specified
|
|
323
|
-
return os.path.join(self.build_path,
|
|
313
|
+
return os.path.join(self.build_path, '.temp.build.log')
|
|
324
314
|
|
|
325
315
|
@computed_field # type: ignore
|
|
326
316
|
@property
|
|
@@ -569,6 +559,8 @@ class App(BaseModel):
|
|
|
569
559
|
|
|
570
560
|
self._post_build()
|
|
571
561
|
|
|
562
|
+
self._finalize()
|
|
563
|
+
|
|
572
564
|
def _post_build(self) -> None:
|
|
573
565
|
"""Post build actions for failed/success builds"""
|
|
574
566
|
if self.build_status not in (
|
|
@@ -615,14 +607,7 @@ class App(BaseModel):
|
|
|
615
607
|
self._logger.warning('%s', line)
|
|
616
608
|
has_unignored_warning = True
|
|
617
609
|
|
|
618
|
-
#
|
|
619
|
-
if self.build_status == BuildStatus.SUCCESS:
|
|
620
|
-
if self.check_warnings and has_unignored_warning:
|
|
621
|
-
self.build_status = BuildStatus.FAILED
|
|
622
|
-
self.build_comment = 'build succeeded with warnings'
|
|
623
|
-
elif has_unignored_warning:
|
|
624
|
-
self.build_comment = 'build succeeded with warnings'
|
|
625
|
-
|
|
610
|
+
# for failed builds, print last few lines to help debug
|
|
626
611
|
if self.build_status == BuildStatus.FAILED:
|
|
627
612
|
# print last few lines to help debug
|
|
628
613
|
self._logger.error(
|
|
@@ -632,10 +617,21 @@ class App(BaseModel):
|
|
|
632
617
|
)
|
|
633
618
|
for line in lines[-self.LOG_DEBUG_LINES :]:
|
|
634
619
|
self._logger.error('%s', line)
|
|
620
|
+
# correct build status for originally successful builds
|
|
621
|
+
elif self.build_status == BuildStatus.SUCCESS:
|
|
622
|
+
if self.check_warnings and has_unignored_warning:
|
|
623
|
+
self.build_status = BuildStatus.FAILED
|
|
624
|
+
self.build_comment = 'build succeeded with warnings'
|
|
625
|
+
elif has_unignored_warning:
|
|
626
|
+
self.build_comment = 'build succeeded with warnings'
|
|
635
627
|
|
|
628
|
+
def _finalize(self) -> None:
|
|
629
|
+
"""
|
|
630
|
+
Actions for real success builds
|
|
631
|
+
"""
|
|
632
|
+
if self.build_status != BuildStatus.SUCCESS:
|
|
636
633
|
return
|
|
637
634
|
|
|
638
|
-
# Actions for real success builds
|
|
639
635
|
# remove temp log file
|
|
640
636
|
if self._is_build_log_path_temp:
|
|
641
637
|
os.unlink(self.build_log_path)
|
|
@@ -751,9 +747,11 @@ class App(BaseModel):
|
|
|
751
747
|
|
|
752
748
|
return False
|
|
753
749
|
|
|
754
|
-
def
|
|
750
|
+
def check_should_build(
|
|
755
751
|
self,
|
|
752
|
+
*,
|
|
756
753
|
manifest_rootpath: t.Optional[str] = None,
|
|
754
|
+
modified_manifest_rules_folders: t.Optional[t.Set[str]] = None,
|
|
757
755
|
check_app_dependencies: bool = False,
|
|
758
756
|
modified_components: t.Optional[t.List[str]] = None,
|
|
759
757
|
modified_files: t.Optional[t.List[str]] = None,
|
|
@@ -766,6 +764,16 @@ class App(BaseModel):
|
|
|
766
764
|
self._checked_should_build = True
|
|
767
765
|
return
|
|
768
766
|
|
|
767
|
+
if (
|
|
768
|
+
self.MANIFEST
|
|
769
|
+
and modified_manifest_rules_folders
|
|
770
|
+
and self.MANIFEST.most_suitable_rule(self.app_dir).folder in modified_manifest_rules_folders
|
|
771
|
+
):
|
|
772
|
+
self.build_status = BuildStatus.SHOULD_BE_BUILT
|
|
773
|
+
self.build_comment = 'current build modifies the related manifest rules'
|
|
774
|
+
self._checked_should_build = True
|
|
775
|
+
return
|
|
776
|
+
|
|
769
777
|
if self.is_modified(modified_files):
|
|
770
778
|
self.build_status = BuildStatus.SHOULD_BE_BUILT
|
|
771
779
|
self.build_comment = 'current build modifies this app'
|
|
@@ -925,7 +933,7 @@ class CMakeApp(App):
|
|
|
925
933
|
)
|
|
926
934
|
|
|
927
935
|
if not self._checked_should_build:
|
|
928
|
-
self.
|
|
936
|
+
self.check_should_build(
|
|
929
937
|
manifest_rootpath=manifest_rootpath,
|
|
930
938
|
modified_components=modified_components,
|
|
931
939
|
modified_files=modified_files,
|