Static factory method to parse a platformio.ini file and return a PlatformIOIni instance. Args: file_path: Path to the platformio.ini file Returns: PlatformIOIni instance with the parsed configuration Raises: FileNotFoundError:
(file_path: Path)
| 933 | |
| 934 | @staticmethod |
| 935 | def parseFile(file_path: Path) -> "PlatformIOIni": |
| 936 | """ |
| 937 | Static factory method to parse a platformio.ini file and return a PlatformIOIni instance. |
| 938 | |
| 939 | Args: |
| 940 | file_path: Path to the platformio.ini file |
| 941 | |
| 942 | Returns: |
| 943 | PlatformIOIni instance with the parsed configuration |
| 944 | |
| 945 | Raises: |
| 946 | FileNotFoundError: If the file doesn't exist |
| 947 | configparser.Error: If the file is malformed |
| 948 | """ |
| 949 | instance = object.__new__(PlatformIOIni) |
| 950 | instance.config = configparser.ConfigParser() |
| 951 | instance.file_path = file_path |
| 952 | |
| 953 | if not file_path.exists(): |
| 954 | raise FileNotFoundError(f"platformio.ini not found: {file_path}") |
| 955 | |
| 956 | try: |
| 957 | instance.config.read(file_path) |
| 958 | instance._parsed_config = None # Will be lazily parsed |
| 959 | logger.debug(f"Successfully parsed platformio.ini: {file_path}") |
| 960 | except configparser.Error as e: |
| 961 | logger.error(f"Error parsing platformio.ini: {e}") |
| 962 | raise |
| 963 | |
| 964 | return instance |
| 965 | |
| 966 | @staticmethod |
| 967 | def parseString(content: str) -> "PlatformIOIni": |