Fix most of the mypy errors in archinstall/default_profiles/ (#2636)
This commit is contained in:
parent
446aa44007
commit
7835784be5
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class PipewireProfile(Profile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Pipewire', ProfileType.Application)
|
||||
|
||||
@property
|
||||
|
|
@ -26,7 +26,7 @@ class PipewireProfile(Profile):
|
|||
'wireplumber'
|
||||
]
|
||||
|
||||
def _enable_pipewire_for_all(self, install_session: 'Installer'):
|
||||
def _enable_pipewire_for_all(self, install_session: 'Installer') -> None:
|
||||
users: Union[User, List[User]] = archinstall.arguments.get('!users', [])
|
||||
if not isinstance(users, list):
|
||||
users = [users]
|
||||
|
|
@ -34,7 +34,7 @@ class PipewireProfile(Profile):
|
|||
for user in users:
|
||||
install_session.arch_chroot('systemctl enable --user pipewire-pulse.service', run_as=user.username)
|
||||
|
||||
def install(self, install_session: 'Installer'):
|
||||
def install(self, install_session: 'Installer') -> None:
|
||||
super().install(install_session)
|
||||
install_session.add_additional_packages(self.packages)
|
||||
self._enable_pipewire_for_all(install_session)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class DesktopProfile(Profile):
|
||||
def __init__(self, current_selection: List[Profile] = []):
|
||||
def __init__(self, current_selection: List[Profile] = []) -> None:
|
||||
super().__init__(
|
||||
'Desktop',
|
||||
ProfileType.Desktop,
|
||||
|
|
@ -48,7 +48,7 @@ class DesktopProfile(Profile):
|
|||
|
||||
return None
|
||||
|
||||
def _do_on_select_profiles(self):
|
||||
def _do_on_select_profiles(self) -> None:
|
||||
for profile in self.current_selection:
|
||||
profile.do_on_select()
|
||||
|
||||
|
|
@ -70,11 +70,11 @@ class DesktopProfile(Profile):
|
|||
case menu.MenuSelectionType.Reset:
|
||||
return SelectResult.ResetCurrent
|
||||
|
||||
def post_install(self, install_session: 'Installer'):
|
||||
def post_install(self, install_session: 'Installer') -> None:
|
||||
for profile in self.current_selection:
|
||||
profile.post_install(install_session)
|
||||
|
||||
def install(self, install_session: 'Installer'):
|
||||
def install(self, install_session: 'Installer') -> None:
|
||||
# Install common packages for all desktop environments
|
||||
install_session.add_additional_packages(self.packages)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class AwesomeProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Awesome', ProfileType.WindowMgr, description='')
|
||||
|
||||
@property
|
||||
|
|
@ -28,7 +28,7 @@ class AwesomeProfile(XorgProfile):
|
|||
'xsel',
|
||||
]
|
||||
|
||||
def install(self, install_session: 'Installer'):
|
||||
def install(self, install_session: 'Installer') -> None:
|
||||
super().install(install_session)
|
||||
|
||||
# TODO: Copy a full configuration to ~/.config/awesome/rc.lua instead.
|
||||
|
|
@ -60,4 +60,4 @@ class AwesomeProfile(XorgProfile):
|
|||
xinitrc_data += 'exec awesome\n'
|
||||
|
||||
with open(f"{install_session.target}/etc/X11/xinit/xinitrc", 'w') as xinitrc:
|
||||
xinitrc.write(xinitrc_data)
|
||||
xinitrc.write(xinitrc_data)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class BspwmProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Bspwm', ProfileType.WindowMgr, description='')
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class BudgieProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Budgie', ProfileType.DesktopEnv, description='')
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class CinnamonProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Cinnamon', ProfileType.DesktopEnv, description='')
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ if TYPE_CHECKING:
|
|||
_: Any
|
||||
|
||||
class CosmicProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('cosmic-epoch', ProfileType.DesktopEnv, description='', advanced=True)
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class CutefishProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Cutefish', ProfileType.DesktopEnv, description='')
|
||||
|
||||
@property
|
||||
|
|
@ -23,5 +23,5 @@ class CutefishProfile(XorgProfile):
|
|||
def default_greeter_type(self) -> Optional[GreeterType]:
|
||||
return GreeterType.Sddm
|
||||
|
||||
def install(self, install_session: 'Installer'):
|
||||
def install(self, install_session: 'Installer') -> None:
|
||||
super().install(install_session)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class DeepinProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Deepin', ProfileType.DesktopEnv, description='')
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class EnlighenmentProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Enlightenment', ProfileType.WindowMgr, description='')
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class GnomeProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Gnome', ProfileType.DesktopEnv, description='')
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class SeatAccess(Enum):
|
|||
|
||||
|
||||
class HyprlandProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Hyprland', ProfileType.DesktopEnv, description='')
|
||||
|
||||
self.custom_settings = {'seat_access': None}
|
||||
|
|
@ -47,7 +47,7 @@ class HyprlandProfile(XorgProfile):
|
|||
return [pref]
|
||||
return []
|
||||
|
||||
def _ask_seat_access(self):
|
||||
def _ask_seat_access(self) -> None:
|
||||
# need to activate seat service and add to seat group
|
||||
title = str(_('Hyprland needs access to your seat (collection of hardware devices i.e. keyboard, mouse, etc)'))
|
||||
title += str(_('\n\nChoose an option to give Hyprland access to your hardware'))
|
||||
|
|
@ -64,5 +64,5 @@ class HyprlandProfile(XorgProfile):
|
|||
def do_on_select(self):
|
||||
self._ask_seat_access()
|
||||
|
||||
def install(self, install_session: 'Installer'):
|
||||
def install(self, install_session: 'Installer') -> None:
|
||||
super().install(install_session)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class I3wmProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('i3-wm', ProfileType.WindowMgr, description='')
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class LxqtProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Lxqt', ProfileType.DesktopEnv, description='')
|
||||
|
||||
# NOTE: SDDM is the only officially supported greeter for LXQt, so unlike other DEs, lightdm is not used here.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class MateProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Mate', ProfileType.DesktopEnv, description='')
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ if TYPE_CHECKING:
|
|||
_: Any
|
||||
|
||||
class PlasmaProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('KDE Plasma', ProfileType.DesktopEnv, description='')
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class QtileProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Qtile', ProfileType.WindowMgr, description='')
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class SeatAccess(Enum):
|
|||
|
||||
|
||||
class SwayProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
'Sway',
|
||||
ProfileType.WindowMgr,
|
||||
|
|
@ -56,7 +56,7 @@ class SwayProfile(XorgProfile):
|
|||
return [pref]
|
||||
return []
|
||||
|
||||
def _ask_seat_access(self):
|
||||
def _ask_seat_access(self) -> None:
|
||||
# need to activate seat service and add to seat group
|
||||
title = str(_('Sway needs access to your seat (collection of hardware devices i.e. keyboard, mouse, etc)'))
|
||||
title += str(_('\n\nChoose an option to give Sway access to your hardware'))
|
||||
|
|
@ -73,5 +73,5 @@ class SwayProfile(XorgProfile):
|
|||
def do_on_select(self):
|
||||
self._ask_seat_access()
|
||||
|
||||
def install(self, install_session: 'Installer'):
|
||||
def install(self, install_session: 'Installer') -> None:
|
||||
super().install(install_session)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class Xfce4Profile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('Xfce4', ProfileType.DesktopEnv, description='')
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Profile:
|
|||
support_gfx_driver: bool = False,
|
||||
support_greeter: bool = False,
|
||||
advanced: bool = False
|
||||
):
|
||||
) -> None:
|
||||
self.name = name
|
||||
self.description = description
|
||||
self.profile_type = profile_type
|
||||
|
|
@ -100,19 +100,19 @@ class Profile:
|
|||
"""
|
||||
return None
|
||||
|
||||
def _advanced_check(self):
|
||||
def _advanced_check(self) -> bool:
|
||||
"""
|
||||
Used to control if the Profile() should be visible or not in different contexts.
|
||||
Returns True if --advanced is given on a Profile(advanced=True) instance.
|
||||
"""
|
||||
return self.advanced is False or storage['arguments'].get('advanced', False) is True
|
||||
|
||||
def install(self, install_session: 'Installer'):
|
||||
def install(self, install_session: 'Installer') -> None:
|
||||
"""
|
||||
Performs installation steps when this profile was selected
|
||||
"""
|
||||
|
||||
def post_install(self, install_session: 'Installer'):
|
||||
def post_install(self, install_session: 'Installer') -> None:
|
||||
"""
|
||||
Hook that will be called when the installation process is
|
||||
finished and custom installation steps for specific default_profiles
|
||||
|
|
@ -131,7 +131,7 @@ class Profile:
|
|||
"""
|
||||
return SelectResult.NewSelection
|
||||
|
||||
def set_custom_settings(self, settings: Dict[str, Any]):
|
||||
def set_custom_settings(self, settings: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Set the custom settings for the profile.
|
||||
This is also called when the settings are parsed from the config
|
||||
|
|
@ -144,7 +144,7 @@ class Profile:
|
|||
return [s.name for s in self.current_selection]
|
||||
return []
|
||||
|
||||
def reset(self):
|
||||
def reset(self) -> None:
|
||||
self.current_selection = []
|
||||
|
||||
def is_top_level_profile(self) -> bool:
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from archinstall.default_profiles.profile import Profile, ProfileType
|
|||
|
||||
|
||||
class CockpitProfile(Profile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
'Cockpit',
|
||||
ProfileType.ServerType
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class DockerProfile(Profile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
'Docker',
|
||||
ProfileType.ServerType
|
||||
|
|
@ -24,7 +24,7 @@ class DockerProfile(Profile):
|
|||
def services(self) -> List[str]:
|
||||
return ['docker']
|
||||
|
||||
def post_install(self, install_session: 'Installer'):
|
||||
def post_install(self, install_session: 'Installer') -> None:
|
||||
users: Union[User, List[User]] = archinstall.arguments.get('!users', [])
|
||||
if not isinstance(users, list):
|
||||
users = [users]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from archinstall.default_profiles.profile import Profile, ProfileType
|
|||
|
||||
|
||||
class HttpdProfile(Profile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
'httpd',
|
||||
ProfileType.ServerType
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from archinstall.default_profiles.profile import Profile, ProfileType
|
|||
|
||||
|
||||
class LighttpdProfile(Profile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
'Lighttpd',
|
||||
ProfileType.ServerType
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class MariadbProfile(Profile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
'Mariadb',
|
||||
ProfileType.ServerType
|
||||
|
|
@ -21,5 +21,5 @@ class MariadbProfile(Profile):
|
|||
def services(self) -> List[str]:
|
||||
return ['mariadb']
|
||||
|
||||
def post_install(self, install_session: 'Installer'):
|
||||
def post_install(self, install_session: 'Installer') -> None:
|
||||
install_session.arch_chroot('mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql')
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from archinstall.default_profiles.profile import Profile, ProfileType
|
|||
|
||||
|
||||
class NginxProfile(Profile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
'Nginx',
|
||||
ProfileType.ServerType
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class PostgresqlProfile(Profile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
'Postgresql',
|
||||
ProfileType.ServerType,
|
||||
|
|
@ -22,5 +22,5 @@ class PostgresqlProfile(Profile):
|
|||
def services(self) -> List[str]:
|
||||
return ['postgresql']
|
||||
|
||||
def post_install(self, install_session: 'Installer'):
|
||||
def post_install(self, install_session: 'Installer') -> None:
|
||||
install_session.arch_chroot("initdb -D /var/lib/postgres/data", run_as='postgres')
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from archinstall.default_profiles.profile import Profile, ProfileType
|
|||
|
||||
|
||||
class SshdProfile(Profile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
'sshd',
|
||||
ProfileType.ServerType
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from archinstall.default_profiles.profile import Profile, ProfileType
|
|||
|
||||
|
||||
class TomcatProfile(Profile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
'Tomcat',
|
||||
ProfileType.ServerType
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class TailoredProfile(XorgProfile):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('52-54-00-12-34-56', ProfileType.Tailored, description='')
|
||||
|
||||
@property
|
||||
def packages(self) -> List[str]:
|
||||
return ['nano', 'wget', 'git']
|
||||
|
||||
def install(self, install_session: 'Installer'):
|
||||
def install(self, install_session: 'Installer') -> None:
|
||||
super().install(install_session)
|
||||
# do whatever you like here :)
|
||||
|
|
|
|||
Loading…
Reference in New Issue