idf-build-apps 2.10.3__py3-none-any.whl → 2.11.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.10.3'
11
+ __version__ = '2.11.0'
12
12
 
13
13
  from .session_args import (
14
14
  SessionArgs,
idf_build_apps/args.py CHANGED
@@ -39,7 +39,6 @@ LOGGER = logging.getLogger(__name__)
39
39
 
40
40
  class ValidateMethod(str, enum.Enum):
41
41
  TO_LIST = 'to_list'
42
- EXPAND_VARS = 'expand_vars'
43
42
 
44
43
 
45
44
  @dataclass
@@ -174,12 +173,17 @@ class BaseArguments(BaseSettings):
174
173
  if info.field_name and info.field_name in cls.model_fields:
175
174
  f = cls.model_fields[info.field_name]
176
175
  meta = get_meta(f)
176
+
177
+ # always expand vars for all fields
178
+ if isinstance(v, str):
179
+ v = expand_vars(v)
180
+ elif isinstance(v, list):
181
+ v = [expand_vars(item) if isinstance(item, str) else item for item in v]
182
+
177
183
  if meta and meta.validate_method:
178
184
  for method in meta.validate_method:
179
185
  if method == ValidateMethod.TO_LIST:
180
186
  v = to_list(v)
181
- elif method == ValidateMethod.EXPAND_VARS:
182
- v = expand_vars(v)
183
187
  else:
184
188
  raise NotImplementedError(f'Unknown validate method: {method}')
185
189
 
@@ -241,9 +245,7 @@ class DependencyDrivenBuildArguments(GlobalArguments):
241
245
  default=None, # type: ignore
242
246
  )
243
247
  manifest_rootpath: str = field(
244
- FieldMetadata(
245
- validate_method=[ValidateMethod.EXPAND_VARS],
246
- ),
248
+ None,
247
249
  description='Root path to resolve the relative paths defined in the manifest files. '
248
250
  'By default set to the current directory. Support environment variables.',
249
251
  default=os.curdir, # type: ignore
@@ -420,6 +422,15 @@ class FindBuildArguments(DependencyDrivenBuildArguments):
420
422
  description='Filter the apps by target. By default set to "all"',
421
423
  default='all', # type: ignore
422
424
  )
425
+ extra_pythonpaths: t.Optional[t.List[str]] = field(
426
+ FieldMetadata(
427
+ validate_method=[ValidateMethod.TO_LIST],
428
+ nargs='+',
429
+ ),
430
+ description='space-separated list of additional Python paths to search for the app classes. '
431
+ 'Will be injected into the head of sys.path.',
432
+ default=None, # type: ignore
433
+ )
423
434
  build_system: t.Union[str, t.Type[App]] = field(
424
435
  None,
425
436
  description='Filter the apps by build system. By default set to "cmake". '
@@ -608,6 +619,14 @@ class FindBuildArguments(DependencyDrivenBuildArguments):
608
619
  if self.override_sdkconfig_files or self.override_sdkconfig_items:
609
620
  SESSION_ARGS.set(self)
610
621
 
622
+ # update PYTHONPATH
623
+ if self.extra_pythonpaths:
624
+ LOGGER.debug('Adding extra Python paths: %s', self.extra_pythonpaths)
625
+ for path in self.extra_pythonpaths:
626
+ abs_path = to_absolute_path(path)
627
+ if abs_path not in sys.path:
628
+ sys.path.insert(0, abs_path)
629
+
611
630
  # load build system
612
631
  # here could be a string or a class of type App
613
632
  if not isinstance(self.build_system, str):
@@ -770,7 +789,6 @@ class BuildArguments(FindBuildArguments):
770
789
  FieldMetadata(
771
790
  deprecates={'collect_size_info': {}},
772
791
  hidden=True,
773
- validate_method=[ValidateMethod.EXPAND_VARS],
774
792
  ),
775
793
  description='Record size json filepath of the built apps to the specified file. '
776
794
  'Each line is a json string. Can expand placeholders @p. Support environment variables.',
@@ -782,7 +800,6 @@ class BuildArguments(FindBuildArguments):
782
800
  FieldMetadata(
783
801
  deprecates={'collect_app_info': {}},
784
802
  hidden=True,
785
- validate_method=[ValidateMethod.EXPAND_VARS],
786
803
  ),
787
804
  description='Record serialized app model of the built apps to the specified file. '
788
805
  'Each line is a json string. Can expand placeholders @p. Support environment variables.',
@@ -794,7 +811,6 @@ class BuildArguments(FindBuildArguments):
794
811
  FieldMetadata(
795
812
  deprecates={'junitxml': {}},
796
813
  hidden=True,
797
- validate_method=[ValidateMethod.EXPAND_VARS],
798
814
  ),
799
815
  description='Path to the junitxml file to record the build results. Can expand placeholder @p. '
800
816
  'Support environment variables.',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: idf-build-apps
3
- Version: 2.10.3
3
+ Version: 2.11.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,7 +1,7 @@
1
- idf_build_apps/__init__.py,sha256=flY7hiaet_0R_QNgtqucTKZAd4e5K99pTLbdxVDGevY,711
1
+ idf_build_apps/__init__.py,sha256=dbJfW0hQTTG-x5k9tWW9qp2EUUYU0CFxCuabbnGJWt4,711
2
2
  idf_build_apps/__main__.py,sha256=pT6OsFQRjCw39Jg43HAeGKzq8h5E_0m7kHDE2QMqDe0,182
3
3
  idf_build_apps/app.py,sha256=Z4TZegsyushNPvWcdSv4jJG1TIkuBMGdQ5FkpOSDFlE,36915
4
- idf_build_apps/args.py,sha256=nyKUDZjP_urzZDmJbkmq_32y0t6wwt-3N59MjLYHWPE,38414
4
+ idf_build_apps/args.py,sha256=Ria0VDBtnUyN3fgHbG9S9P7gyWYoJ3YxrN_C0z6XEeQ,38977
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=yJnsYdcbX-TzUDrp8h1YJrLfBziQW4RiyLiJ47sHRY4,6375
@@ -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.10.3.dist-info/entry_points.txt,sha256=3pVUirUEsb6jsDRikkQWNUt4hqLK2ci1HvW_Vf8b6uE,59
24
- idf_build_apps-2.10.3.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
25
- idf_build_apps-2.10.3.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
26
- idf_build_apps-2.10.3.dist-info/METADATA,sha256=9T4kiw8GB4e5qFzKD7W76N4ufKqT1HeXd5H_YOw47vU,4795
27
- idf_build_apps-2.10.3.dist-info/RECORD,,
23
+ idf_build_apps-2.11.0.dist-info/entry_points.txt,sha256=3pVUirUEsb6jsDRikkQWNUt4hqLK2ci1HvW_Vf8b6uE,59
24
+ idf_build_apps-2.11.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
25
+ idf_build_apps-2.11.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
26
+ idf_build_apps-2.11.0.dist-info/METADATA,sha256=v9SrMcpVGeGM3HhR8rxJrdO2WfRAwedxth8Pf4OBexY,4795
27
+ idf_build_apps-2.11.0.dist-info/RECORD,,