mirror of
https://git.launchpad.net/livecd-rootfs
synced 2026-02-17 07:23:29 +00:00
Use match statement with local imports in boot configurator factory
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
516d8b8913
commit
edc2fa0fc5
@ -20,24 +20,29 @@ def make_boot_configurator_for_arch(
|
||||
iso_root: pathlib.Path,
|
||||
) -> "BaseBootConfigurator":
|
||||
"""Factory function to create boot configurator for a specific architecture."""
|
||||
from .amd64 import AMD64BootConfigurator
|
||||
from .arm64 import ARM64BootConfigurator
|
||||
from .ppc64el import PPC64ELBootConfigurator
|
||||
from .riscv64 import RISCV64BootConfigurator
|
||||
from .s390x import S390XBootConfigurator
|
||||
match arch:
|
||||
case "amd64":
|
||||
from .amd64 import AMD64BootConfigurator
|
||||
|
||||
if arch == "amd64":
|
||||
return AMD64BootConfigurator(logger, apt_state, iso_root)
|
||||
elif arch == "arm64":
|
||||
return ARM64BootConfigurator(logger, apt_state, iso_root)
|
||||
elif arch == "ppc64el":
|
||||
return PPC64ELBootConfigurator(logger, apt_state, iso_root)
|
||||
elif arch == "riscv64":
|
||||
return RISCV64BootConfigurator(logger, apt_state, iso_root)
|
||||
elif arch == "s390x":
|
||||
return S390XBootConfigurator(logger, apt_state, iso_root)
|
||||
else:
|
||||
raise ValueError(f"Unsupported architecture: {arch}")
|
||||
return AMD64BootConfigurator(logger, apt_state, iso_root)
|
||||
case "arm64":
|
||||
from .arm64 import ARM64BootConfigurator
|
||||
|
||||
return ARM64BootConfigurator(logger, apt_state, iso_root)
|
||||
case "ppc64el":
|
||||
from .ppc64el import PPC64ELBootConfigurator
|
||||
|
||||
return PPC64ELBootConfigurator(logger, apt_state, iso_root)
|
||||
case "riscv64":
|
||||
from .riscv64 import RISCV64BootConfigurator
|
||||
|
||||
return RISCV64BootConfigurator(logger, apt_state, iso_root)
|
||||
case "s390x":
|
||||
from .s390x import S390XBootConfigurator
|
||||
|
||||
return S390XBootConfigurator(logger, apt_state, iso_root)
|
||||
case _:
|
||||
raise ValueError(f"Unsupported architecture: {arch}")
|
||||
|
||||
|
||||
__all__ = ["make_boot_configurator_for_arch"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user