Parse the [env] section into a typed dataclass.
(
config: configparser.ConfigParser,
)
| 746 | |
| 747 | |
| 748 | def _parse_global_env_section( |
| 749 | config: configparser.ConfigParser, |
| 750 | ) -> Optional[GlobalEnvSection]: |
| 751 | """ |
| 752 | Parse the [env] section into a typed dataclass. |
| 753 | """ |
| 754 | if not config.has_section("env"): |
| 755 | return None |
| 756 | |
| 757 | section = config["env"] |
| 758 | |
| 759 | # Parse list-based options |
| 760 | build_flags = _parse_list_value(section.get("build_flags", "")) |
| 761 | build_src_filter = _parse_list_value(section.get("build_src_filter", "")) |
| 762 | lib_deps = _parse_list_value(section.get("lib_deps", "")) |
| 763 | lib_ignore = _parse_list_value(section.get("lib_ignore", "")) |
| 764 | lib_extra_dirs = _parse_list_value(section.get("lib_extra_dirs", "")) |
| 765 | monitor_filters = _parse_list_value(section.get("monitor_filters", "")) |
| 766 | extra_scripts = _parse_list_value(section.get("extra_scripts", "")) |
| 767 | |
| 768 | # Handle custom options |
| 769 | standard_options = { |
| 770 | "build_flags", |
| 771 | "build_src_filter", |
| 772 | "lib_deps", |
| 773 | "lib_ignore", |
| 774 | "lib_extra_dirs", |
| 775 | "lib_ldf_mode", |
| 776 | "monitor_speed", |
| 777 | "monitor_filters", |
| 778 | "extra_scripts", |
| 779 | } |
| 780 | |
| 781 | custom_options: dict[str, str] = {} |
| 782 | for key, value in section.items(): |
| 783 | if key not in standard_options: |
| 784 | custom_options[key] = value |
| 785 | |
| 786 | return GlobalEnvSection( |
| 787 | build_flags=build_flags, |
| 788 | build_src_filter=build_src_filter, |
| 789 | lib_deps=lib_deps, |
| 790 | lib_ignore=lib_ignore, |
| 791 | lib_extra_dirs=lib_extra_dirs, |
| 792 | lib_ldf_mode=section.get("lib_ldf_mode"), |
| 793 | monitor_speed=section.get("monitor_speed"), |
| 794 | monitor_filters=monitor_filters, |
| 795 | extra_scripts=extra_scripts, |
| 796 | custom_options=custom_options, |
| 797 | ) |
| 798 | |
| 799 | |
| 800 | def _resolve_package_url_from_registry( |
no test coverage detected