54
54
"labwc" : "W3" ,
55
55
}
56
56
57
+
57
58
# pylint: disable=too-many-public-methods
58
59
class Shell :
59
60
"""
@@ -590,9 +591,9 @@ def is_minumum_version(self, version):
590
591
if version .lower () not in RASPI_VERSIONS :
591
592
raise ValueError ("Invalid version" )
592
593
# Check that the current version is at least the specified version
593
- return RASPI_VERSIONS .index (self . get_raspbian_version ()) >= RASPI_VERSIONS . index (
594
- version . lower ()
595
- )
594
+ return RASPI_VERSIONS .index (
595
+ self . get_raspbian_version ()
596
+ ) >= RASPI_VERSIONS . index ( version . lower ())
596
597
597
598
def prompt_reboot (self , default = "y" , ** kwargs ):
598
599
"""Prompt the user for a reboot"""
@@ -622,8 +623,11 @@ def check_kernel_userspace_mismatch(self, attempt_fix=True, fix_with_x11=False):
622
623
"Unable to compile driver because kernel space is 64-bit, but user space is 32-bit."
623
624
)
624
625
config = self .get_boot_config ()
625
- if self .is_raspberry_pi_os () and attempt_fix and config and self .prompt (
626
- f"Add parameter to { config } to use 32-bit kernel?"
626
+ if (
627
+ self .is_raspberry_pi_os ()
628
+ and attempt_fix
629
+ and config
630
+ and self .prompt (f"Add parameter to { config } to use 32-bit kernel?" )
627
631
):
628
632
# Set to use 32-bit kernel
629
633
self .reconfig (config , "^.*arm_64bit.*$" , "arm_64bit=0" )
@@ -640,14 +644,16 @@ def set_window_manager(self, manager):
640
644
if not self .is_minumum_version ("bullseye" ):
641
645
return
642
646
643
- if manager .lower () not in WINDOW_MANAGERS . keys () :
647
+ if manager .lower () not in WINDOW_MANAGERS :
644
648
raise ValueError ("Invalid window manager" )
645
649
646
650
if manager .lower () == "labwc" and not self .exists ("/usr/bin/labwc" ):
647
651
raise RuntimeError ("labwc is not installed" )
648
652
649
653
print (f"Using { manager } as the window manager" )
650
- if not self .run_command ("sudo raspi-config nonint do_wayland " + WINDOW_MANAGERS [manager .lower ()]):
654
+ if not self .run_command (
655
+ "sudo raspi-config nonint do_wayland " + WINDOW_MANAGERS [manager .lower ()]
656
+ ):
651
657
raise RuntimeError ("Unable to change window manager" )
652
658
653
659
def get_boot_config (self ):
@@ -657,7 +663,7 @@ def get_boot_config(self):
657
663
# check if /boot/firmware/config.txt exists
658
664
if self .exists ("/boot/firmware/config.txt" ):
659
665
return "/boot/firmware/config.txt"
660
- elif self .exists ("/boot/config.txt" ):
666
+ if self .exists ("/boot/config.txt" ):
661
667
return "/boot/config.txt"
662
668
return None
663
669
0 commit comments