MCPcopy Create free account
hub / github.com/FastLED/FastLED / _apply_global_env

Method _apply_global_env

ci/compiler/platformio_ini.py:1308–1352  ·  view source on GitHub ↗

Apply global environment settings to an environment section.

(
        self, env_section: EnvironmentSection, global_env: Optional[GlobalEnvSection]
    )

Source from the content-addressed store, hash-verified

1306 return merged
1307
1308 def _apply_global_env(
1309 self, env_section: EnvironmentSection, global_env: Optional[GlobalEnvSection]
1310 ) -> EnvironmentSection:
1311 """
1312 Apply global environment settings to an environment section.
1313 """
1314 if not global_env:
1315 return env_section
1316
1317 from dataclasses import replace
1318
1319 # Apply global settings where environment doesn't have them
1320 merged = replace(env_section)
1321
1322 # String fields
1323 if not merged.lib_ldf_mode and global_env.lib_ldf_mode:
1324 merged.lib_ldf_mode = global_env.lib_ldf_mode
1325 if not merged.monitor_speed and global_env.monitor_speed:
1326 merged.monitor_speed = global_env.monitor_speed
1327
1328 # List fields - prepend global values
1329 if global_env.build_flags:
1330 merged.build_flags = global_env.build_flags + merged.build_flags
1331 if global_env.build_src_filter:
1332 merged.build_src_filter = (
1333 global_env.build_src_filter + merged.build_src_filter
1334 )
1335 if global_env.lib_deps:
1336 merged.lib_deps = global_env.lib_deps + merged.lib_deps
1337 if global_env.lib_ignore:
1338 merged.lib_ignore = global_env.lib_ignore + merged.lib_ignore
1339 if global_env.lib_extra_dirs:
1340 merged.lib_extra_dirs = global_env.lib_extra_dirs + merged.lib_extra_dirs
1341 if global_env.monitor_filters:
1342 merged.monitor_filters = global_env.monitor_filters + merged.monitor_filters
1343 if global_env.extra_scripts:
1344 merged.extra_scripts = global_env.extra_scripts + merged.extra_scripts
1345
1346 # Custom options
1347 if global_env.custom_options:
1348 merged_custom = global_env.custom_options.copy()
1349 merged_custom.update(merged.custom_options)
1350 merged.custom_options = merged_custom
1351
1352 return merged
1353
1354 def get_platformio_section(self) -> Optional[PlatformIOSection]:
1355 """

Callers 1

_resolve_inheritanceMethod · 0.95

Calls 3

replaceFunction · 0.85
copyMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected