mirror of
https://git.launchpad.net/livecd-rootfs
synced 2026-02-17 15:33:32 +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,23 +20,28 @@ def make_boot_configurator_for_arch(
|
|||||||
iso_root: pathlib.Path,
|
iso_root: pathlib.Path,
|
||||||
) -> "BaseBootConfigurator":
|
) -> "BaseBootConfigurator":
|
||||||
"""Factory function to create boot configurator for a specific architecture."""
|
"""Factory function to create boot configurator for a specific architecture."""
|
||||||
|
match arch:
|
||||||
|
case "amd64":
|
||||||
from .amd64 import AMD64BootConfigurator
|
from .amd64 import AMD64BootConfigurator
|
||||||
|
|
||||||
|
return AMD64BootConfigurator(logger, apt_state, iso_root)
|
||||||
|
case "arm64":
|
||||||
from .arm64 import ARM64BootConfigurator
|
from .arm64 import ARM64BootConfigurator
|
||||||
|
|
||||||
|
return ARM64BootConfigurator(logger, apt_state, iso_root)
|
||||||
|
case "ppc64el":
|
||||||
from .ppc64el import PPC64ELBootConfigurator
|
from .ppc64el import PPC64ELBootConfigurator
|
||||||
|
|
||||||
|
return PPC64ELBootConfigurator(logger, apt_state, iso_root)
|
||||||
|
case "riscv64":
|
||||||
from .riscv64 import RISCV64BootConfigurator
|
from .riscv64 import RISCV64BootConfigurator
|
||||||
|
|
||||||
|
return RISCV64BootConfigurator(logger, apt_state, iso_root)
|
||||||
|
case "s390x":
|
||||||
from .s390x import S390XBootConfigurator
|
from .s390x import S390XBootConfigurator
|
||||||
|
|
||||||
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)
|
return S390XBootConfigurator(logger, apt_state, iso_root)
|
||||||
else:
|
case _:
|
||||||
raise ValueError(f"Unsupported architecture: {arch}")
|
raise ValueError(f"Unsupported architecture: {arch}")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user