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

Function get_pio_execution_env

ci/compiler/build_utils.py:25–65  ·  view source on GitHub ↗

Get environment suitable for PlatformIO execution. On Windows Git Bash: Returns clean environment without Git Bash indicators (strips MSYSTEM, TERM, SHELL, etc.) to prevent ESP-IDF toolchain errors. On other platforms: Returns UTF-8 environment (same as get_utf8_env()). This funct

()

Source from the content-addressed store, hash-verified

23
24
25def get_pio_execution_env() -> dict[str, str]:
26 """Get environment suitable for PlatformIO execution.
27
28 On Windows Git Bash: Returns clean environment without Git Bash indicators
29 (strips MSYSTEM, TERM, SHELL, etc.) to prevent ESP-IDF toolchain errors.
30
31 On other platforms: Returns UTF-8 environment (same as get_utf8_env()).
32
33 This function solves the ESP-IDF v5.5.x incompatibility with Git Bash:
34 "ERROR: MSys/Mingw is not supported. Please follow the getting started guide"
35
36 Returns:
37 Environment dict suitable for running PlatformIO commands
38 """
39 import os
40
41 from ci.util.windows_cmd_runner import get_clean_windows_env, should_use_cmd_runner
42
43 if should_use_cmd_runner():
44 # Windows Git Bash: Use clean environment without Git Bash indicators
45 env = get_clean_windows_env()
46 else:
47 # Linux/Mac or native Windows shell: Use UTF-8 environment
48 env = get_utf8_env()
49
50 # Verify PLATFORMIO_SRC_DIR is preserved (debugging)
51 if "PLATFORMIO_SRC_DIR" in os.environ and "PLATFORMIO_SRC_DIR" not in env:
52 # This should never happen - log error for debugging
53 import sys
54
55 print(
56 "⚠️ WARNING: PLATFORMIO_SRC_DIR was set but not preserved in subprocess environment!",
57 file=sys.stderr,
58 )
59 print(
60 f" Parent process has: PLATFORMIO_SRC_DIR={os.environ['PLATFORMIO_SRC_DIR']}",
61 file=sys.stderr,
62 )
63 print(" This is a bug in get_pio_execution_env()", file=sys.stderr)
64
65 return env
66
67
68def create_building_banner(example: str) -> str:

Callers 6

_init_platformio_buildFunction · 0.90
_build_internalMethod · 0.90
deployMethod · 0.90
build_with_merged_binMethod · 0.90
create_pio_processFunction · 0.90
run_pio_commandFunction · 0.90

Calls 4

should_use_cmd_runnerFunction · 0.90
get_clean_windows_envFunction · 0.90
get_utf8_envFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected