Resolve a platform shorthand name to comprehensive URL information. Args: platform_name: Platform name like 'espressif32', 'atmelavr', etc., or a full URL force_resolve: If True, query PlatformIO even for URLs to get package information Returns:
(
self, platform_name: str, force_resolve: bool = False
)
| 1717 | return repository_url |
| 1718 | |
| 1719 | def resolve_platform_url_enhanced( |
| 1720 | self, platform_name: str, force_resolve: bool = False |
| 1721 | ) -> Optional[PlatformUrlResolution]: |
| 1722 | """ |
| 1723 | Resolve a platform shorthand name to comprehensive URL information. |
| 1724 | |
| 1725 | Args: |
| 1726 | platform_name: Platform name like 'espressif32', 'atmelavr', etc., or a full URL |
| 1727 | force_resolve: If True, query PlatformIO even for URLs to get package information |
| 1728 | |
| 1729 | Returns: |
| 1730 | PlatformUrlResolution with git_url, zip_url, packages, etc. or None if resolution fails. |
| 1731 | """ |
| 1732 | # Check if it's already a URL or local path |
| 1733 | url_type = self._classify_url_type(platform_name) |
| 1734 | is_url = url_type in ("git", "zip", "file") |
| 1735 | |
| 1736 | # If it's a URL and we're not forcing resolution, return basic info |
| 1737 | if is_url and not force_resolve: |
| 1738 | resolution = PlatformUrlResolution(name=platform_name) |
| 1739 | |
| 1740 | if url_type == "git": |
| 1741 | resolution.git_url = platform_name |
| 1742 | elif url_type == "zip": |
| 1743 | resolution.zip_url = platform_name |
| 1744 | elif url_type == "file": |
| 1745 | resolution.local_path = platform_name |
| 1746 | |
| 1747 | return resolution |
| 1748 | |
| 1749 | # Check cache first (use normalized key for URLs) |
| 1750 | cache_key = platform_name |
| 1751 | if self._is_platform_cached(cache_key): |
| 1752 | cached = self._platform_cache[cache_key] |
| 1753 | logger.debug(f"Using cached enhanced platform resolution for {cache_key}") |
| 1754 | if cached.enhanced_resolution: |
| 1755 | return cached.enhanced_resolution |
| 1756 | # Fall back to creating resolution from cached data |
| 1757 | return PlatformUrlResolution( |
| 1758 | name=platform_name, |
| 1759 | git_url=cached.git_url, |
| 1760 | zip_url=cached.zip_url, |
| 1761 | version=cached.version, |
| 1762 | frameworks=cached.frameworks, |
| 1763 | ) |
| 1764 | |
| 1765 | # Resolve via PlatformIO CLI using typed response |
| 1766 | # PlatformIO can resolve both shorthand names and URLs |
| 1767 | platform_show = self._get_platform_show_typed(platform_name) |
| 1768 | if not platform_show: |
| 1769 | logger.warning(f"Failed to resolve platform: {platform_name}") |
| 1770 | return None |
| 1771 | |
| 1772 | # Extract package information from typed response |
| 1773 | packages = self._extract_packages_from_platform_response(platform_show) |
| 1774 | |
| 1775 | # Classify the repository URL type |
| 1776 | git_url = None |