Coverage for src/ezcompiler/adapters/installer_factory.py: 100.00%
15 statements
« prev ^ index » next coverage.py v7.14.3, created at 2026-07-04 11:22 +0000
« prev ^ index » next coverage.py v7.14.3, created at 2026-07-04 11:22 +0000
1# ///////////////////////////////////////////////////////////////
2# INSTALLER_FACTORY - Factory for installer instances
3# Project: ezcompiler
4# ///////////////////////////////////////////////////////////////
6"""Installer factory - Centralized creation of installer instances by type."""
8from __future__ import annotations
10# ///////////////////////////////////////////////////////////////
11# IMPORTS
12# ///////////////////////////////////////////////////////////////
13from typing import Any
15from .._types import InstallerPort
16from ..shared.exceptions import InstallerTypeError
17from ._innosetup_installer import InnoSetupInstaller
19# ///////////////////////////////////////////////////////////////
20# CLASSES
21# ///////////////////////////////////////////////////////////////
24class InstallerFactory:
25 """Factory class for creating installer instances."""
27 # ------------------------------------------------
28 # FACTORY METHODS
29 # ------------------------------------------------
31 @staticmethod
32 def create_installer(
33 installer_type: str, config: dict[str, Any] | None = None
34 ) -> InstallerPort:
35 """Create an installer instance for the given type.
37 Args:
38 installer_type: Type of installer builder ("innosetup")
39 config: Configuration dictionary for the installer adapter
41 Returns:
42 InstallerPort: Configured installer instance (satisfies the Port)
44 Raises:
45 InstallerTypeError: If installer type is not supported
46 """
47 normalized = installer_type.lower()
48 if normalized == "innosetup":
49 return InnoSetupInstaller(config)
50 raise InstallerTypeError(f"Unsupported installer type: {installer_type}")
52 @staticmethod
53 def get_supported_types() -> list[str]:
54 """Return the list of supported installer backend names."""
55 return ["innosetup"]