idf-build-apps 2.9.0__py3-none-any.whl → 2.10.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.
- idf_build_apps/__init__.py +3 -1
- idf_build_apps/app.py +8 -0
- idf_build_apps/args.py +56 -6
- idf_build_apps/main.py +33 -18
- {idf_build_apps-2.9.0.dist-info → idf_build_apps-2.10.1.dist-info}/METADATA +3 -2
- {idf_build_apps-2.9.0.dist-info → idf_build_apps-2.10.1.dist-info}/RECORD +9 -9
- {idf_build_apps-2.9.0.dist-info → idf_build_apps-2.10.1.dist-info}/WHEEL +0 -0
- {idf_build_apps-2.9.0.dist-info → idf_build_apps-2.10.1.dist-info}/entry_points.txt +0 -0
- {idf_build_apps-2.9.0.dist-info → idf_build_apps-2.10.1.dist-info}/licenses/LICENSE +0 -0
idf_build_apps/__init__.py
CHANGED
|
@@ -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.
|
|
11
|
+
__version__ = '2.10.1'
|
|
12
12
|
|
|
13
13
|
from .session_args import (
|
|
14
14
|
SessionArgs,
|
|
@@ -28,6 +28,7 @@ from .log import (
|
|
|
28
28
|
from .main import (
|
|
29
29
|
build_apps,
|
|
30
30
|
find_apps,
|
|
31
|
+
json_list_files_to_apps,
|
|
31
32
|
json_to_app,
|
|
32
33
|
)
|
|
33
34
|
|
|
@@ -38,6 +39,7 @@ __all__ = [
|
|
|
38
39
|
'MakeApp',
|
|
39
40
|
'build_apps',
|
|
40
41
|
'find_apps',
|
|
42
|
+
'json_list_files_to_apps',
|
|
41
43
|
'json_to_app',
|
|
42
44
|
'setup_logging',
|
|
43
45
|
]
|
idf_build_apps/app.py
CHANGED
|
@@ -1011,3 +1011,11 @@ class AppDeserializer(BaseModel):
|
|
|
1011
1011
|
def from_json(cls, json_data: t.Union[str, bytes, bytearray]) -> App:
|
|
1012
1012
|
json_dict = json.loads(json_data.strip())
|
|
1013
1013
|
return cls.model_validate({'app': json_dict}).app
|
|
1014
|
+
|
|
1015
|
+
@classmethod
|
|
1016
|
+
def from_json_list(cls, json_list: t.Sequence[t.Union[str, bytes, bytearray]]) -> t.List[App]:
|
|
1017
|
+
apps = []
|
|
1018
|
+
for app_json in json_list:
|
|
1019
|
+
apps.append(cls.from_json(app_json))
|
|
1020
|
+
|
|
1021
|
+
return apps
|
idf_build_apps/args.py
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import argparse
|
|
5
5
|
import enum
|
|
6
6
|
import glob
|
|
7
|
+
import importlib
|
|
7
8
|
import inspect
|
|
8
9
|
import logging
|
|
9
10
|
import os
|
|
@@ -27,7 +28,7 @@ from pydantic_settings import (
|
|
|
27
28
|
)
|
|
28
29
|
from typing_extensions import Concatenate, ParamSpec
|
|
29
30
|
|
|
30
|
-
from . import SESSION_ARGS, App, setup_logging
|
|
31
|
+
from . import SESSION_ARGS, App, CMakeApp, MakeApp, setup_logging
|
|
31
32
|
from .constants import ALL_TARGETS, IDF_BUILD_APPS_TOML_FN, SUPPORTED_TARGETS
|
|
32
33
|
from .manifest.manifest import FolderRule, Manifest
|
|
33
34
|
from .utils import InvalidCommand, files_matches_patterns, semicolon_separated_str_to_list, to_absolute_path, to_list
|
|
@@ -397,6 +398,12 @@ class DependencyDrivenBuildArguments(GlobalArguments):
|
|
|
397
398
|
|
|
398
399
|
|
|
399
400
|
class FindBuildArguments(DependencyDrivenBuildArguments):
|
|
401
|
+
_KNOWN_APP_CLASSES: t.ClassVar[t.Dict[str, t.Type[App]]] = {
|
|
402
|
+
'cmake': CMakeApp,
|
|
403
|
+
'make': MakeApp,
|
|
404
|
+
}
|
|
405
|
+
_LOADED_MODULE_APPS: t.ClassVar[t.Dict[str, t.Type[App]]] = {}
|
|
406
|
+
|
|
400
407
|
paths: t.List[str] = field(
|
|
401
408
|
FieldMetadata(
|
|
402
409
|
validate_method=[ValidateMethod.TO_LIST],
|
|
@@ -414,10 +421,9 @@ class FindBuildArguments(DependencyDrivenBuildArguments):
|
|
|
414
421
|
default='all', # type: ignore
|
|
415
422
|
)
|
|
416
423
|
build_system: t.Union[str, t.Type[App]] = field(
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
description='Filter the apps by build system. By default set to "cmake"',
|
|
424
|
+
None,
|
|
425
|
+
description='Filter the apps by build system. By default set to "cmake". '
|
|
426
|
+
'Can be either "cmake", "make" or a custom App class path in format "module:class"',
|
|
421
427
|
default='cmake', # type: ignore
|
|
422
428
|
)
|
|
423
429
|
recursive: bool = field(
|
|
@@ -587,12 +593,56 @@ class FindBuildArguments(DependencyDrivenBuildArguments):
|
|
|
587
593
|
|
|
588
594
|
if self.disable_targets and FolderRule.DEFAULT_BUILD_TARGETS:
|
|
589
595
|
LOGGER.info('Disable targets: %s', self.disable_targets)
|
|
590
|
-
self.default_build_targets = [
|
|
596
|
+
self.default_build_targets = [
|
|
597
|
+
_target for _target in FolderRule.DEFAULT_BUILD_TARGETS if _target not in self.disable_targets
|
|
598
|
+
]
|
|
591
599
|
FolderRule.DEFAULT_BUILD_TARGETS = self.default_build_targets
|
|
592
600
|
|
|
593
601
|
if self.override_sdkconfig_files or self.override_sdkconfig_items:
|
|
594
602
|
SESSION_ARGS.set(self)
|
|
595
603
|
|
|
604
|
+
# load build system
|
|
605
|
+
# here could be a string or a class of type App
|
|
606
|
+
if not isinstance(self.build_system, str):
|
|
607
|
+
# do nothing, only cache
|
|
608
|
+
self._KNOWN_APP_CLASSES[self.build_system('', '').build_system] = self.build_system
|
|
609
|
+
return
|
|
610
|
+
|
|
611
|
+
# here could only be a string
|
|
612
|
+
if self.build_system in self._KNOWN_APP_CLASSES:
|
|
613
|
+
self.build_system = self._KNOWN_APP_CLASSES[self.build_system]
|
|
614
|
+
return
|
|
615
|
+
|
|
616
|
+
if ':' not in self.build_system:
|
|
617
|
+
raise ValueError(
|
|
618
|
+
f'Invalid build system: {self.build_system}. '
|
|
619
|
+
f'Known build systems: {", ".join(self._KNOWN_APP_CLASSES.keys())}'
|
|
620
|
+
)
|
|
621
|
+
|
|
622
|
+
# here could only be a string in format "module:class"
|
|
623
|
+
if self.build_system in self._LOADED_MODULE_APPS:
|
|
624
|
+
self.build_system = self._LOADED_MODULE_APPS[self.build_system]
|
|
625
|
+
return
|
|
626
|
+
|
|
627
|
+
# here could only be a string in format "module:class", and not loaded yet
|
|
628
|
+
module_path, class_name = self.build_system.split(':')
|
|
629
|
+
try:
|
|
630
|
+
module = importlib.import_module(module_path)
|
|
631
|
+
except ImportError as e:
|
|
632
|
+
raise ImportError(f'Failed to import module {module_path}. Error: {e!s}')
|
|
633
|
+
|
|
634
|
+
try:
|
|
635
|
+
app_cls = getattr(module, class_name)
|
|
636
|
+
if not issubclass(app_cls, App):
|
|
637
|
+
raise ValueError(f'Class {class_name} must be a subclass of App')
|
|
638
|
+
except (ValueError, AttributeError):
|
|
639
|
+
raise ValueError(f'Class {class_name} not found in module {module_path}')
|
|
640
|
+
|
|
641
|
+
self._LOADED_MODULE_APPS[self.build_system] = app_cls
|
|
642
|
+
self._KNOWN_APP_CLASSES[app_cls('', '').build_system] = app_cls
|
|
643
|
+
|
|
644
|
+
self.build_system = app_cls
|
|
645
|
+
|
|
596
646
|
|
|
597
647
|
class FindArguments(FindBuildArguments):
|
|
598
648
|
output: t.Optional[str] = field(
|
idf_build_apps/main.py
CHANGED
|
@@ -29,8 +29,6 @@ from idf_build_apps.args import (
|
|
|
29
29
|
from .app import (
|
|
30
30
|
App,
|
|
31
31
|
AppDeserializer,
|
|
32
|
-
CMakeApp,
|
|
33
|
-
MakeApp,
|
|
34
32
|
)
|
|
35
33
|
from .autocompletions import activate_completions
|
|
36
34
|
from .constants import ALL_TARGETS, BuildStatus, completion_instructions
|
|
@@ -88,18 +86,6 @@ def find_apps(
|
|
|
88
86
|
**kwargs,
|
|
89
87
|
)
|
|
90
88
|
|
|
91
|
-
app_cls: t.Type[App]
|
|
92
|
-
if isinstance(find_arguments.build_system, str):
|
|
93
|
-
# backwards compatible
|
|
94
|
-
if find_arguments.build_system == 'cmake':
|
|
95
|
-
app_cls = CMakeApp
|
|
96
|
-
elif find_arguments.build_system == 'make':
|
|
97
|
-
app_cls = MakeApp
|
|
98
|
-
else:
|
|
99
|
-
raise ValueError('Only Support "make" and "cmake"')
|
|
100
|
-
else:
|
|
101
|
-
app_cls = find_arguments.build_system
|
|
102
|
-
|
|
103
89
|
apps: t.Set[App] = set()
|
|
104
90
|
if find_arguments.target == 'all':
|
|
105
91
|
targets = ALL_TARGETS
|
|
@@ -115,7 +101,7 @@ def find_apps(
|
|
|
115
101
|
_find_apps(
|
|
116
102
|
_p,
|
|
117
103
|
_t,
|
|
118
|
-
app_cls=
|
|
104
|
+
app_cls=find_arguments.build_system, # type: ignore
|
|
119
105
|
args=find_arguments,
|
|
120
106
|
)
|
|
121
107
|
)
|
|
@@ -487,14 +473,43 @@ def json_to_app(json_str: str, extra_classes: t.Optional[t.List[t.Type[App]]] =
|
|
|
487
473
|
:param extra_classes: extra App class
|
|
488
474
|
:return: App object
|
|
489
475
|
"""
|
|
490
|
-
|
|
476
|
+
_known_classes = list(FindArguments()._KNOWN_APP_CLASSES.values())
|
|
491
477
|
if extra_classes:
|
|
492
|
-
|
|
478
|
+
_known_classes.extend(extra_classes)
|
|
493
479
|
|
|
494
480
|
custom_deserializer = create_model(
|
|
495
481
|
'_CustomDeserializer',
|
|
496
|
-
app=(t.Union[tuple(
|
|
482
|
+
app=(t.Union[tuple(_known_classes)], Field(discriminator='build_system')),
|
|
497
483
|
__base__=AppDeserializer,
|
|
498
484
|
)
|
|
499
485
|
|
|
500
486
|
return custom_deserializer.from_json(json_str)
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
def json_list_files_to_apps(
|
|
490
|
+
json_list_filepaths: t.List[str],
|
|
491
|
+
extra_classes: t.Optional[t.List[t.Type[App]]] = None,
|
|
492
|
+
) -> t.List[App]:
|
|
493
|
+
"""
|
|
494
|
+
Deserialize a list of json strings to App objects
|
|
495
|
+
|
|
496
|
+
:param json_list_filepaths: filepath to the files, each line is a json string
|
|
497
|
+
:param extra_classes: extra App class
|
|
498
|
+
:return: list of App object
|
|
499
|
+
"""
|
|
500
|
+
_known_classes = list(FindArguments()._KNOWN_APP_CLASSES.values())
|
|
501
|
+
if extra_classes:
|
|
502
|
+
_known_classes.extend(extra_classes)
|
|
503
|
+
|
|
504
|
+
custom_deserializer = create_model(
|
|
505
|
+
'_CustomDeserializer',
|
|
506
|
+
app=(t.Union[tuple(_known_classes)], Field(discriminator='build_system')),
|
|
507
|
+
__base__=AppDeserializer,
|
|
508
|
+
)
|
|
509
|
+
|
|
510
|
+
jsons = []
|
|
511
|
+
for fp in json_list_filepaths:
|
|
512
|
+
with open(fp) as fr:
|
|
513
|
+
jsons.extend(fr.readlines())
|
|
514
|
+
|
|
515
|
+
return custom_deserializer.from_json_list(jsons)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: idf-build-apps
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.10.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
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
|
-
Classifier: Development Status ::
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
9
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.7
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.8
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
17
|
License-File: LICENSE
|
|
17
18
|
Requires-Dist: pyparsing
|
|
18
19
|
Requires-Dist: pyyaml
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
idf_build_apps/__init__.py,sha256=
|
|
1
|
+
idf_build_apps/__init__.py,sha256=20NqJN4TGWNWQmCELK2yHFpTJtstbRhr5rMUOr6TkzQ,711
|
|
2
2
|
idf_build_apps/__main__.py,sha256=pT6OsFQRjCw39Jg43HAeGKzq8h5E_0m7kHDE2QMqDe0,182
|
|
3
|
-
idf_build_apps/app.py,sha256=
|
|
4
|
-
idf_build_apps/args.py,sha256=
|
|
3
|
+
idf_build_apps/app.py,sha256=wwwpEciOFwjTmkb-IoucM1CeIqAYVSPxNAEsxti-Frg,36914
|
|
4
|
+
idf_build_apps/args.py,sha256=BBTDk87nBaHodn_VLp65jvhtwjLsskX7qZLTDLRH6kY,37968
|
|
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
7
|
idf_build_apps/finder.py,sha256=wayWyUSCyMvkY72xU-b7IW7I48cv6C-pRqJHMHQsh0c,5794
|
|
8
8
|
idf_build_apps/log.py,sha256=15sSQhv9dJsHShDR2KgFGFp8ByjV0HogLr1X1lHYqGs,3899
|
|
9
|
-
idf_build_apps/main.py,sha256=
|
|
9
|
+
idf_build_apps/main.py,sha256=BOCAlcN019NkV7s4wBWlNht911Gh9BVT-x9JIj3IlOE,17927
|
|
10
10
|
idf_build_apps/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
idf_build_apps/session_args.py,sha256=yM-78vFzCDCdhXHNxTALmzE4w2NSmka8yVBbh3wtvC8,2985
|
|
12
12
|
idf_build_apps/utils.py,sha256=cQJ5N-53vrASa4d8WW0AQCPJzendArXyU3kB5Vx-AH8,10880
|
|
@@ -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.
|
|
24
|
-
idf_build_apps-2.
|
|
25
|
-
idf_build_apps-2.
|
|
26
|
-
idf_build_apps-2.
|
|
27
|
-
idf_build_apps-2.
|
|
23
|
+
idf_build_apps-2.10.1.dist-info/entry_points.txt,sha256=3pVUirUEsb6jsDRikkQWNUt4hqLK2ci1HvW_Vf8b6uE,59
|
|
24
|
+
idf_build_apps-2.10.1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
25
|
+
idf_build_apps-2.10.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
26
|
+
idf_build_apps-2.10.1.dist-info/METADATA,sha256=-lAyB6KVFTYVMK9NwDAcyl-sc_oYKxYNBfY79HFto3Y,4795
|
|
27
|
+
idf_build_apps-2.10.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|