Coverage for src/ezcompiler/services/installer_service.py: 100.00%

9 statements  

« prev     ^ index     » next       coverage.py v7.14.3, created at 2026-07-04 11:22 +0000

1# /////////////////////////////////////////////////////////////// 

2# INSTALLER_SERVICE - Installer build orchestration service 

3# Project: ezcompiler 

4# /////////////////////////////////////////////////////////////// 

5 

6""" 

7Installer service - Orchestrates first-deployment installer packaging. 

8 

9Builds a setup.exe from a compiled bundle via an installer adapter 

10(InstallerFactory). Mirrors ReleaseService's structure. 

11""" 

12 

13from __future__ import annotations 

14 

15# /////////////////////////////////////////////////////////////// 

16# IMPORTS 

17# /////////////////////////////////////////////////////////////// 

18from pathlib import Path 

19from typing import Any 

20 

21from ..adapters import InstallerFactory 

22 

23# /////////////////////////////////////////////////////////////// 

24# CLASSES 

25# /////////////////////////////////////////////////////////////// 

26 

27 

28class InstallerService: 

29 """Service orchestrating first-deployment installer packaging.""" 

30 

31 # ------------------------------------------------ 

32 # BUILD METHODS 

33 # ------------------------------------------------ 

34 

35 @staticmethod 

36 def build_installer( 

37 bundle_dir: Path, 

38 app_name: str, 

39 version: str, 

40 output_dir: Path, 

41 *, 

42 installer_type: str = "innosetup", 

43 installer_config: dict[str, Any] | None = None, 

44 ) -> Path: 

45 """Build the installer executable for a compiled bundle. 

46 

47 Args: 

48 bundle_dir: Directory containing the compiled application. 

49 app_name: Application name. 

50 version: Application version string. 

51 output_dir: Directory where the setup.exe is produced. 

52 installer_type: Installer backend to use (default: "innosetup"). 

53 installer_config: Extra config forwarded to the installer adapter 

54 (e.g. "icon", "company_name", "iss_path", "iscc_path"). 

55 

56 Returns: 

57 Path: The produced setup.exe path. 

58 

59 Raises: 

60 InstallerError: When installer packaging fails. 

61 """ 

62 installer = InstallerFactory.create_installer(installer_type, installer_config) 

63 return installer.build( 

64 bundle_dir=bundle_dir, 

65 app_name=app_name, 

66 version=version, 

67 output_dir=output_dir, 

68 )