From 1e9d1d29d553fc31bd8c8640ec0a60191c56e74f Mon Sep 17 00:00:00 2001 From: raihan2000 Date: Sun, 20 Oct 2024 20:21:19 +0530 Subject: [PATCH] chroot/device: add cast to satisfy typechecker --- chroot/device.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/chroot/device.py b/chroot/device.py index bd04467..099a7eb 100644 --- a/chroot/device.py +++ b/chroot/device.py @@ -1,7 +1,7 @@ import atexit import os -from typing import ClassVar, Optional +from typing import ClassVar, Optional, cast from config.state import config from constants import Arch, BASE_PACKAGES @@ -20,15 +20,14 @@ class DeviceChroot(BuildChroot): _copy_base: ClassVar[bool] = False def create_rootfs(self, reset, pacman_conf_target, active_previously): - clss = BuildChroot if self.copy_base else BaseChroot - makedir(config.get_path('chroots')) root_makedir(self.get_path()) if not self.copy_base: pacman_conf_target = os.path.join(get_temp_dir(register_cleanup=True), f'pacman-{self.name}.conf') self.write_pacman_conf(in_chroot=False, absolute_path=pacman_conf_target) - - clss.create_rootfs(self, reset, pacman_conf_target, active_previously) + BaseChroot.create_rootfs(cast(BaseChroot, self), reset, pacman_conf_target, active_previously) + else: + BuildChroot.create_rootfs(self, reset, pacman_conf_target, active_previously) def mount_rootfs(self, source_path: str, fs_type: Optional[str] = None, options: list[str] = [], allow_overlay: bool = False): if self.active: