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

Function get_default_environment

ci/util/pio_package_daemon.py:536–568  ·  view source on GitHub ↗

Read default_envs from platformio.ini. Args: project_dir: Path to PlatformIO project directory Returns: First default environment name, or None if not found

(project_dir: str)

Source from the content-addressed store, hash-verified

534
535
536def get_default_environment(project_dir: str) -> str | None:
537 """Read default_envs from platformio.ini.
538
539 Args:
540 project_dir: Path to PlatformIO project directory
541
542 Returns:
543 First default environment name, or None if not found
544 """
545 ini_path = Path(project_dir) / "platformio.ini"
546 if not ini_path.exists():
547 return None
548
549 try:
550 config = configparser.ConfigParser()
551 config.read(ini_path)
552
553 # Get default_envs from [platformio] section
554 if config.has_section("platformio") and config.has_option(
555 "platformio", "default_envs"
556 ):
557 default_envs = config.get("platformio", "default_envs")
558 # Can be comma-separated list, take first one
559 first_env = default_envs.split(",")[0].strip()
560 return first_env if first_env else None
561
562 return None
563 except KeyboardInterrupt as ki:
564 handle_keyboard_interrupt(ki)
565 raise
566 except Exception as e:
567 logging.warning(f"Failed to read default_envs from platformio.ini: {e}")
568 return None
569
570
571def process_package_request(request: PackageRequest) -> bool:

Callers 4

mainFunction · 0.90
process_package_requestFunction · 0.85

Calls 6

has_sectionMethod · 0.80
has_optionMethod · 0.80
warningMethod · 0.80
readMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected