Remove is_subpath() and use Path.is_relative_to() (#4372)
This commit is contained in:
parent
56bec01979
commit
e2bd7b3405
|
|
@ -36,7 +36,6 @@ from archinstall.lib.models.device import (
|
|||
)
|
||||
from archinstall.lib.models.users import Password
|
||||
from archinstall.lib.output import debug, error, info, log
|
||||
from archinstall.lib.utils.util import is_subpath
|
||||
|
||||
|
||||
class DeviceHandler:
|
||||
|
|
@ -563,7 +562,7 @@ class DeviceHandler:
|
|||
for device in self.devices:
|
||||
for part_info in device.partition_infos:
|
||||
for mountpoint in part_info.mountpoints:
|
||||
if is_subpath(mountpoint, base_mountpoint):
|
||||
if mountpoint.is_relative_to(base_mountpoint):
|
||||
path = Path(part_info.disk.device.path)
|
||||
part_mods.setdefault(path, [])
|
||||
part_mod = PartitionModification.from_existing_partition(part_info)
|
||||
|
|
|
|||
|
|
@ -20,17 +20,6 @@ def generate_password(length: int = 64) -> str:
|
|||
return ''.join(secrets.choice(haystack) for _ in range(length))
|
||||
|
||||
|
||||
def is_subpath(first: Path, second: Path) -> bool:
|
||||
"""
|
||||
Check if _first_ a subpath of _second_
|
||||
"""
|
||||
try:
|
||||
first.relative_to(second)
|
||||
return True
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
def format_cols(items: list[str], header: str | None = None) -> str:
|
||||
if header:
|
||||
text = f'{header}:\n'
|
||||
|
|
|
|||
Loading…
Reference in New Issue