mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	merge
This commit is contained in:
		| @@ -13,6 +13,7 @@ from .const import ( | |||||||
|     CORE_SUBCATEGORY_PATTERNS, |     CORE_SUBCATEGORY_PATTERNS, | ||||||
|     DEMANGLED_PATTERNS, |     DEMANGLED_PATTERNS, | ||||||
|     ESPHOME_COMPONENT_PATTERN, |     ESPHOME_COMPONENT_PATTERN, | ||||||
|  |     SECTION_MAPPING, | ||||||
|     SYMBOL_PATTERNS, |     SYMBOL_PATTERNS, | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -23,23 +24,21 @@ _LOGGER = logging.getLogger(__name__) | |||||||
| @cache | @cache | ||||||
| def get_esphome_components(): | def get_esphome_components(): | ||||||
|     """Get set of actual ESPHome components from the components directory.""" |     """Get set of actual ESPHome components from the components directory.""" | ||||||
|     components = set() |  | ||||||
|  |  | ||||||
|     # Find the components directory relative to this file |     # Find the components directory relative to this file | ||||||
|     # Go up two levels from analyze_memory/__init__.py to esphome/ |     # Go up two levels from analyze_memory/__init__.py to esphome/ | ||||||
|     current_dir = Path(__file__).parent.parent |     current_dir = Path(__file__).parent.parent | ||||||
|     components_dir = current_dir / "components" |     components_dir = current_dir / "components" | ||||||
|  |  | ||||||
|     if components_dir.exists() and components_dir.is_dir(): |     if not components_dir.exists() or not components_dir.is_dir(): | ||||||
|         for item in components_dir.iterdir(): |         return frozenset() | ||||||
|             if ( |  | ||||||
|                 item.is_dir() |     return frozenset( | ||||||
|  |         item.name | ||||||
|  |         for item in components_dir.iterdir() | ||||||
|  |         if item.is_dir() | ||||||
|         and not item.name.startswith(".") |         and not item.name.startswith(".") | ||||||
|         and not item.name.startswith("__") |         and not item.name.startswith("__") | ||||||
|             ): |     ) | ||||||
|                 components.add(item.name) |  | ||||||
|  |  | ||||||
|     return components |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @cache | @cache | ||||||
| @@ -179,13 +178,6 @@ class MemoryAnalyzer: | |||||||
|  |  | ||||||
|     def _parse_symbols(self) -> None: |     def _parse_symbols(self) -> None: | ||||||
|         """Parse symbols from ELF file.""" |         """Parse symbols from ELF file.""" | ||||||
|         # Section mapping - centralizes the logic |  | ||||||
|         SECTION_MAPPING = { |  | ||||||
|             ".text": [".text", ".iram"], |  | ||||||
|             ".rodata": [".rodata"], |  | ||||||
|             ".data": [".data", ".dram"], |  | ||||||
|             ".bss": [".bss"], |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         def map_section_name(raw_section: str) -> str | None: |         def map_section_name(raw_section: str) -> str | None: | ||||||
|             """Map raw section name to standard section.""" |             """Map raw section name to standard section.""" | ||||||
|   | |||||||
| @@ -5,6 +5,15 @@ import re | |||||||
| # Pattern to extract ESPHome component namespaces dynamically | # Pattern to extract ESPHome component namespaces dynamically | ||||||
| ESPHOME_COMPONENT_PATTERN = re.compile(r"esphome::([a-zA-Z0-9_]+)::") | ESPHOME_COMPONENT_PATTERN = re.compile(r"esphome::([a-zA-Z0-9_]+)::") | ||||||
|  |  | ||||||
|  | # Section mapping for ELF file sections | ||||||
|  | # Maps standard section names to their various platform-specific variants | ||||||
|  | SECTION_MAPPING = { | ||||||
|  |     ".text": frozenset([".text", ".iram"]), | ||||||
|  |     ".rodata": frozenset([".rodata"]), | ||||||
|  |     ".data": frozenset([".data", ".dram"]), | ||||||
|  |     ".bss": frozenset([".bss"]), | ||||||
|  | } | ||||||
|  |  | ||||||
| # Component identification rules | # Component identification rules | ||||||
| # Symbol patterns: patterns found in raw symbol names | # Symbol patterns: patterns found in raw symbol names | ||||||
| SYMBOL_PATTERNS = { | SYMBOL_PATTERNS = { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user