Start replacing Optional with union syntax (UP007 rule in Ruff) (#2836)
This commit is contained in:
parent
58e4a94fdf
commit
8cda091e6d
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Any, TYPE_CHECKING, Optional
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.lib.output import info
|
from archinstall.lib.output import info
|
||||||
from archinstall.lib.profile.profiles_handler import profile_handler
|
from archinstall.lib.profile.profiles_handler import profile_handler
|
||||||
|
|
@ -40,7 +40,7 @@ class DesktopProfile(Profile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
combined_greeters: dict[GreeterType, int] = {}
|
combined_greeters: dict[GreeterType, int] = {}
|
||||||
for profile in self.current_selection:
|
for profile in self.current_selection:
|
||||||
if profile.default_greeter_type:
|
if profile.default_greeter_type:
|
||||||
|
|
@ -56,7 +56,7 @@ class DesktopProfile(Profile):
|
||||||
for profile in self.current_selection:
|
for profile in self.current_selection:
|
||||||
profile.do_on_select()
|
profile.do_on_select()
|
||||||
|
|
||||||
def do_on_select(self) -> Optional[SelectResult]:
|
def do_on_select(self) -> SelectResult | None:
|
||||||
items = [
|
items = [
|
||||||
MenuItem(
|
MenuItem(
|
||||||
p.name,
|
p.name,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -23,5 +23,5 @@ class BspwmProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Lightdm
|
return GreeterType.Lightdm
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -22,5 +22,5 @@ class BudgieProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.LightdmSlick
|
return GreeterType.LightdmSlick
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -28,5 +28,5 @@ class CinnamonProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Lightdm
|
return GreeterType.Lightdm
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -18,5 +18,5 @@ class CosmicProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.CosmicSession
|
return GreeterType.CosmicSession
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -20,7 +20,7 @@ class CutefishProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Sddm
|
return GreeterType.Sddm
|
||||||
|
|
||||||
def install(self, install_session: 'Installer') -> None:
|
def install(self, install_session: 'Installer') -> None:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -20,5 +20,5 @@ class DeepinProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Lightdm
|
return GreeterType.Lightdm
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -19,5 +19,5 @@ class EnlighenmentProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Lightdm
|
return GreeterType.Lightdm
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -19,5 +19,5 @@ class GnomeProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Gdm
|
return GreeterType.Gdm
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Optional, TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType, SelectResult
|
from archinstall.default_profiles.profile import ProfileType, GreeterType, SelectResult
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -41,7 +41,7 @@ class HyprlandProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Sddm
|
return GreeterType.Sddm
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
@ -73,7 +73,7 @@ class HyprlandProfile(XorgProfile):
|
||||||
if result.item() is not None:
|
if result.item() is not None:
|
||||||
self.custom_settings['seat_access'] = result.get_value()
|
self.custom_settings['seat_access'] = result.get_value()
|
||||||
|
|
||||||
def do_on_select(self) -> Optional[SelectResult]:
|
def do_on_select(self) -> SelectResult | None:
|
||||||
self._ask_seat_access()
|
self._ask_seat_access()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -26,5 +26,5 @@ class I3wmProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Lightdm
|
return GreeterType.Lightdm
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -27,5 +27,5 @@ class LxqtProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Sddm
|
return GreeterType.Sddm
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -19,5 +19,5 @@ class MateProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Lightdm
|
return GreeterType.Lightdm
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -24,5 +24,5 @@ class PlasmaProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Sddm
|
return GreeterType.Sddm
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -19,5 +19,5 @@ class QtileProfile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Lightdm
|
return GreeterType.Lightdm
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Optional, TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType, SelectResult
|
from archinstall.default_profiles.profile import ProfileType, GreeterType, SelectResult
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -51,7 +51,7 @@ class SwayProfile(XorgProfile):
|
||||||
] + additional
|
] + additional
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Lightdm
|
return GreeterType.Lightdm
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
@ -83,7 +83,7 @@ class SwayProfile(XorgProfile):
|
||||||
if result.item() is not None:
|
if result.item() is not None:
|
||||||
self.custom_settings['seat_access'] = result.get_value()
|
self.custom_settings['seat_access'] = result.get_value()
|
||||||
|
|
||||||
def do_on_select(self) -> Optional[SelectResult]:
|
def do_on_select(self) -> SelectResult | None:
|
||||||
self._ask_seat_access()
|
self._ask_seat_access()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
from archinstall.default_profiles.profile import ProfileType, GreeterType
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
|
|
@ -22,5 +22,5 @@ class Xfce4Profile(XorgProfile):
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
return GreeterType.Lightdm
|
return GreeterType.Lightdm
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
from typing import Optional, Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from ..lib.storage import storage
|
from ..lib.storage import storage
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ class Profile:
|
||||||
self._support_gfx_driver = support_gfx_driver
|
self._support_gfx_driver = support_gfx_driver
|
||||||
self._support_greeter = support_greeter
|
self._support_greeter = support_greeter
|
||||||
|
|
||||||
# self.gfx_driver: Optional[str] = None
|
# self.gfx_driver: str | None = None
|
||||||
|
|
||||||
self.current_selection = current_selection
|
self.current_selection = current_selection
|
||||||
self._packages = packages
|
self._packages = packages
|
||||||
|
|
@ -94,7 +94,7 @@ class Profile:
|
||||||
return self._services
|
return self._services
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_greeter_type(self) -> Optional[GreeterType]:
|
def default_greeter_type(self) -> GreeterType | None:
|
||||||
"""
|
"""
|
||||||
Setting a default greeter type for a desktop profile
|
Setting a default greeter type for a desktop profile
|
||||||
"""
|
"""
|
||||||
|
|
@ -125,7 +125,7 @@ class Profile:
|
||||||
"""
|
"""
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def do_on_select(self) -> Optional[SelectResult]:
|
def do_on_select(self) -> SelectResult | None:
|
||||||
"""
|
"""
|
||||||
Hook that will be called when a profile is selected
|
Hook that will be called when a profile is selected
|
||||||
"""
|
"""
|
||||||
|
|
@ -180,7 +180,7 @@ class Profile:
|
||||||
def is_greeter_supported(self) -> bool:
|
def is_greeter_supported(self) -> bool:
|
||||||
return self._support_greeter
|
return self._support_greeter
|
||||||
|
|
||||||
def preview_text(self) -> Optional[str]:
|
def preview_text(self) -> str | None:
|
||||||
"""
|
"""
|
||||||
Override this method to provide a preview text for the profile
|
Override this method to provide a preview text for the profile
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Any, TYPE_CHECKING, Optional
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.lib.output import info
|
from archinstall.lib.output import info
|
||||||
from archinstall.lib.profile.profiles_handler import profile_handler
|
from archinstall.lib.profile.profiles_handler import profile_handler
|
||||||
|
|
@ -23,7 +23,7 @@ class ServerProfile(Profile):
|
||||||
current_selection=current_value
|
current_selection=current_value
|
||||||
)
|
)
|
||||||
|
|
||||||
def do_on_select(self) -> Optional[SelectResult]:
|
def do_on_select(self) -> SelectResult | None:
|
||||||
items = [
|
items = [
|
||||||
MenuItem(
|
MenuItem(
|
||||||
p.name,
|
p.name,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Any, Optional, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from archinstall.default_profiles.profile import Profile, ProfileType
|
from archinstall.default_profiles.profile import Profile, ProfileType
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ class XorgProfile(Profile):
|
||||||
advanced=advanced
|
advanced=advanced
|
||||||
)
|
)
|
||||||
|
|
||||||
def preview_text(self) -> Optional[str]:
|
def preview_text(self) -> str | None:
|
||||||
text = str(_('Environment type: {}')).format(self.profile_type.value)
|
text = str(_('Environment type: {}')).format(self.profile_type.value)
|
||||||
if packages := self.packages_text():
|
if packages := self.packages_text():
|
||||||
text += f'\n{packages}'
|
text += f'\n{packages}'
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import time
|
import time
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
from typing import Optional
|
|
||||||
from .exceptions import SysCallError
|
from .exceptions import SysCallError
|
||||||
from .general import SysCommand, SysCommandWorker, locate_binary
|
from .general import SysCommand, SysCommandWorker, locate_binary
|
||||||
from .installer import Installer
|
from .installer import Installer
|
||||||
|
|
@ -12,7 +11,7 @@ class Boot:
|
||||||
def __init__(self, installation: Installer):
|
def __init__(self, installation: Installer):
|
||||||
self.instance = installation
|
self.instance = installation
|
||||||
self.container_name = 'archinstall'
|
self.container_name = 'archinstall'
|
||||||
self.session: Optional[SysCommandWorker] = None
|
self.session: SysCommandWorker | None = None
|
||||||
self.ready = False
|
self.ready = False
|
||||||
|
|
||||||
def __enter__(self) -> 'Boot':
|
def __enter__(self) -> 'Boot':
|
||||||
|
|
@ -54,7 +53,7 @@ class Boot:
|
||||||
)
|
)
|
||||||
|
|
||||||
shutdown = None
|
shutdown = None
|
||||||
shutdown_exit_code: Optional[int] = -1
|
shutdown_exit_code: int | None = -1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
shutdown = SysCommand(f'systemd-run --machine={self.container_name} --pty shutdown now')
|
shutdown = SysCommand(f'systemd-run --machine={self.container_name} --pty shutdown now')
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import time
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
from typing import Any, Optional, TYPE_CHECKING, Union
|
from typing import Any, TYPE_CHECKING, Union
|
||||||
|
|
||||||
from . import disk
|
from . import disk
|
||||||
from .exceptions import DiskError, ServiceException, RequirementError, HardwareIncompatibilityError, SysCallError
|
from .exceptions import DiskError, ServiceException, RequirementError, HardwareIncompatibilityError, SysCallError
|
||||||
|
|
@ -47,9 +47,9 @@ class Installer:
|
||||||
self,
|
self,
|
||||||
target: Path,
|
target: Path,
|
||||||
disk_config: disk.DiskLayoutConfiguration,
|
disk_config: disk.DiskLayoutConfiguration,
|
||||||
disk_encryption: Optional[disk.DiskEncryption] = None,
|
disk_encryption: disk.DiskEncryption | None = None,
|
||||||
base_packages: list[str] = [],
|
base_packages: list[str] = [],
|
||||||
kernels: Optional[list[str]] = None
|
kernels: list[str] | None = None
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
`Installer()` is the wrapper for most basic installation steps.
|
`Installer()` is the wrapper for most basic installation steps.
|
||||||
|
|
@ -628,7 +628,7 @@ class Installer:
|
||||||
def run_command(self, cmd: str, *args: str, **kwargs: str) -> SysCommand:
|
def run_command(self, cmd: str, *args: str, **kwargs: str) -> SysCommand:
|
||||||
return SysCommand(f'/usr/bin/arch-chroot {self.target} {cmd}')
|
return SysCommand(f'/usr/bin/arch-chroot {self.target} {cmd}')
|
||||||
|
|
||||||
def arch_chroot(self, cmd: str, run_as: Optional[str] = None) -> SysCommand:
|
def arch_chroot(self, cmd: str, run_as: str | None = None) -> SysCommand:
|
||||||
if run_as:
|
if run_as:
|
||||||
cmd = f"su - {run_as} -c {shlex.quote(cmd)}"
|
cmd = f"su - {run_as} -c {shlex.quote(cmd)}"
|
||||||
|
|
||||||
|
|
@ -736,7 +736,7 @@ class Installer:
|
||||||
log(error.worker._trace_log.decode())
|
log(error.worker._trace_log.decode())
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _get_microcode(self) -> Optional[Path]:
|
def _get_microcode(self) -> Path | None:
|
||||||
if not SysInfo.is_vm():
|
if not SysInfo.is_vm():
|
||||||
if vendor := SysInfo.cpu_vendor():
|
if vendor := SysInfo.cpu_vendor():
|
||||||
return vendor.get_ucode()
|
return vendor.get_ucode()
|
||||||
|
|
@ -911,19 +911,19 @@ class Installer:
|
||||||
else:
|
else:
|
||||||
raise ValueError("Archinstall currently only supports setting up swap on zram")
|
raise ValueError("Archinstall currently only supports setting up swap on zram")
|
||||||
|
|
||||||
def _get_efi_partition(self) -> Optional[disk.PartitionModification]:
|
def _get_efi_partition(self) -> disk.PartitionModification | None:
|
||||||
for layout in self._disk_config.device_modifications:
|
for layout in self._disk_config.device_modifications:
|
||||||
if partition := layout.get_efi_partition():
|
if partition := layout.get_efi_partition():
|
||||||
return partition
|
return partition
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _get_boot_partition(self) -> Optional[disk.PartitionModification]:
|
def _get_boot_partition(self) -> disk.PartitionModification | None:
|
||||||
for layout in self._disk_config.device_modifications:
|
for layout in self._disk_config.device_modifications:
|
||||||
if boot := layout.get_boot_partition():
|
if boot := layout.get_boot_partition():
|
||||||
return boot
|
return boot
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _get_root(self) -> Optional[disk.PartitionModification | disk.LvmVolume]:
|
def _get_root(self) -> disk.PartitionModification | disk.LvmVolume | None:
|
||||||
if self._disk_config.lvm_config:
|
if self._disk_config.lvm_config:
|
||||||
return self._disk_config.lvm_config.get_root_volume()
|
return self._disk_config.lvm_config.get_root_volume()
|
||||||
else:
|
else:
|
||||||
|
|
@ -1054,7 +1054,7 @@ class Installer:
|
||||||
self,
|
self,
|
||||||
boot_partition: disk.PartitionModification,
|
boot_partition: disk.PartitionModification,
|
||||||
root: disk.PartitionModification | disk.LvmVolume,
|
root: disk.PartitionModification | disk.LvmVolume,
|
||||||
efi_partition: Optional[disk.PartitionModification],
|
efi_partition: disk.PartitionModification | None,
|
||||||
uki_enabled: bool = False
|
uki_enabled: bool = False
|
||||||
) -> None:
|
) -> None:
|
||||||
debug('Installing systemd bootloader')
|
debug('Installing systemd bootloader')
|
||||||
|
|
@ -1153,7 +1153,7 @@ class Installer:
|
||||||
self,
|
self,
|
||||||
boot_partition: disk.PartitionModification,
|
boot_partition: disk.PartitionModification,
|
||||||
root: disk.PartitionModification | disk.LvmVolume,
|
root: disk.PartitionModification | disk.LvmVolume,
|
||||||
efi_partition: Optional[disk.PartitionModification]
|
efi_partition: disk.PartitionModification | None
|
||||||
) -> None:
|
) -> None:
|
||||||
debug('Installing grub bootloader')
|
debug('Installing grub bootloader')
|
||||||
|
|
||||||
|
|
@ -1237,7 +1237,7 @@ class Installer:
|
||||||
def _add_limine_bootloader(
|
def _add_limine_bootloader(
|
||||||
self,
|
self,
|
||||||
boot_partition: disk.PartitionModification,
|
boot_partition: disk.PartitionModification,
|
||||||
efi_partition: Optional[disk.PartitionModification],
|
efi_partition: disk.PartitionModification | None,
|
||||||
root: disk.PartitionModification | disk.LvmVolume
|
root: disk.PartitionModification | disk.LvmVolume
|
||||||
) -> None:
|
) -> None:
|
||||||
debug('Installing limine bootloader')
|
debug('Installing limine bootloader')
|
||||||
|
|
@ -1381,7 +1381,7 @@ Exec = /bin/sh -c "{hook_command}"
|
||||||
def _config_uki(
|
def _config_uki(
|
||||||
self,
|
self,
|
||||||
root: disk.PartitionModification | disk.LvmVolume,
|
root: disk.PartitionModification | disk.LvmVolume,
|
||||||
efi_partition: Optional[disk.PartitionModification]
|
efi_partition: disk.PartitionModification | None
|
||||||
) -> None:
|
) -> None:
|
||||||
if not efi_partition or not efi_partition.mountpoint:
|
if not efi_partition or not efi_partition.mountpoint:
|
||||||
raise ValueError(f'Could not detect ESP at mountpoint {self.target}')
|
raise ValueError(f'Could not detect ESP at mountpoint {self.target}')
|
||||||
|
|
@ -1512,7 +1512,7 @@ Exec = /bin/sh -c "{hook_command}"
|
||||||
for user in users:
|
for user in users:
|
||||||
self.user_create(user.username, user.password, user.groups, user.sudo)
|
self.user_create(user.username, user.password, user.groups, user.sudo)
|
||||||
|
|
||||||
def user_create(self, user: str, password: Optional[str] = None, groups: Optional[list[str]] = None, sudo: bool = False) -> None:
|
def user_create(self, user: str, password: str | None = None, groups: list[str] | None = None, sudo: bool = False) -> None:
|
||||||
if groups is None:
|
if groups is None:
|
||||||
groups = []
|
groups = []
|
||||||
|
|
||||||
|
|
@ -1630,7 +1630,7 @@ Exec = /bin/sh -c "{hook_command}"
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _service_started(self, service_name: str) -> Optional[str]:
|
def _service_started(self, service_name: str) -> str | None:
|
||||||
if os.path.splitext(service_name)[1] not in ('.service', '.target', '.timer'):
|
if os.path.splitext(service_name)[1] not in ('.service', '.target', '.timer'):
|
||||||
service_name += '.service' # Just to be safe
|
service_name += '.service' # Just to be safe
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, TYPE_CHECKING, Optional
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
from ..output import FormattedOutput
|
from ..output import FormattedOutput
|
||||||
from ..general import secret
|
from ..general import secret
|
||||||
|
|
@ -14,11 +14,11 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
def get_password(
|
def get_password(
|
||||||
text: str,
|
text: str,
|
||||||
header: Optional[str] = None,
|
header: str | None = None,
|
||||||
allow_skip: bool = False,
|
allow_skip: bool = False,
|
||||||
preset: Optional[str] = None
|
preset: str | None = None
|
||||||
) -> Optional[str]:
|
) -> str | None:
|
||||||
failure: Optional[str] = None
|
failure: str | None = None
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_hdr = None
|
user_hdr = None
|
||||||
|
|
@ -63,12 +63,12 @@ def get_password(
|
||||||
|
|
||||||
def prompt_dir(
|
def prompt_dir(
|
||||||
text: str,
|
text: str,
|
||||||
header: Optional[str] = None,
|
header: str | None = None,
|
||||||
validate: bool = True,
|
validate: bool = True,
|
||||||
allow_skip: bool = False,
|
allow_skip: bool = False,
|
||||||
preset: Optional[str] = None
|
preset: str | None = None
|
||||||
) -> Optional[Path]:
|
) -> Path | None:
|
||||||
def validate_path(path: str) -> Optional[str]:
|
def validate_path(path: str) -> str | None:
|
||||||
dest_path = Path(path)
|
dest_path = Path(path)
|
||||||
|
|
||||||
if dest_path.exists() and dest_path.is_dir():
|
if dest_path.exists() and dest_path.is_dir():
|
||||||
|
|
@ -107,7 +107,7 @@ def is_subpath(first: Path, second: Path) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def format_cols(items: list[str], header: Optional[str] = None) -> str:
|
def format_cols(items: list[str], header: str | None = None) -> str:
|
||||||
if header:
|
if header:
|
||||||
text = f'{header}:\n'
|
text = f'{header}:\n'
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -806,8 +806,8 @@ class SelectMenu(AbstractCurses):
|
||||||
alignment: Alignment = Alignment.LEFT,
|
alignment: Alignment = Alignment.LEFT,
|
||||||
columns: int = 1,
|
columns: int = 1,
|
||||||
column_spacing: int = 10,
|
column_spacing: int = 10,
|
||||||
header: Optional[str] = None,
|
header: str | None = None,
|
||||||
frame: Optional[FrameProperties] = None,
|
frame: FrameProperties | None = None,
|
||||||
cursor_char: str = '>',
|
cursor_char: str = '>',
|
||||||
search_enabled: bool = True,
|
search_enabled: bool = True,
|
||||||
allow_skip: bool = False,
|
allow_skip: bool = False,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import archinstall
|
import archinstall
|
||||||
from archinstall import info, debug
|
from archinstall import info, debug
|
||||||
|
|
@ -97,7 +96,7 @@ def perform_installation(mountpoint: Path) -> None:
|
||||||
|
|
||||||
# If user selected to copy the current ISO network configuration
|
# If user selected to copy the current ISO network configuration
|
||||||
# Perform a copy of the config
|
# Perform a copy of the config
|
||||||
network_config: Optional[NetworkConfiguration] = archinstall.arguments.get('network_config', None)
|
network_config: NetworkConfiguration | None = archinstall.arguments.get('network_config', None)
|
||||||
|
|
||||||
if network_config:
|
if network_config:
|
||||||
network_config.install_network_config(
|
network_config.install_network_config(
|
||||||
|
|
@ -108,7 +107,7 @@ def perform_installation(mountpoint: Path) -> None:
|
||||||
if users := archinstall.arguments.get('!users', None):
|
if users := archinstall.arguments.get('!users', None):
|
||||||
installation.create_users(users)
|
installation.create_users(users)
|
||||||
|
|
||||||
audio_config: Optional[AudioConfiguration] = archinstall.arguments.get('audio_config', None)
|
audio_config: AudioConfiguration | None = archinstall.arguments.get('audio_config', None)
|
||||||
if audio_config:
|
if audio_config:
|
||||||
audio_config.install_audio_config(installation)
|
audio_config.install_audio_config(installation)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue