From 904ff2f3d516f01e7845105fd4c49063a4676846 Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Wed, 15 Apr 2026 08:17:12 -0400 Subject: [PATCH 1/2] Use UPPER_CASE for PartitionType --- archinstall/lib/disk/disk_menu.py | 10 +++++----- archinstall/lib/disk/partitioning_menu.py | 4 ++-- archinstall/lib/models/device.py | 14 +++++++------- docs/examples/python.rst | 2 +- examples/full_automated_installation.py | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/archinstall/lib/disk/disk_menu.py b/archinstall/lib/disk/disk_menu.py index 9cc7271a41..95a73c6b8d 100644 --- a/archinstall/lib/disk/disk_menu.py +++ b/archinstall/lib/disk/disk_menu.py @@ -503,7 +503,7 @@ def _boot_partition(sector_size: SectorSize, using_gpt: bool) -> PartitionModifi # boot partition return PartitionModification( status=ModificationStatus.CREATE, - type=PartitionType.Primary, + type=PartitionType.PRIMARY, start=start, length=size, mountpoint=Path('/boot'), @@ -655,7 +655,7 @@ async def suggest_single_disk_layout( root_partition = PartitionModification( status=ModificationStatus.CREATE, - type=PartitionType.Primary, + type=PartitionType.PRIMARY, start=root_start, length=root_length, mountpoint=Path('/') if not using_subvolumes else None, @@ -680,7 +680,7 @@ async def suggest_single_disk_layout( home_partition = PartitionModification( status=ModificationStatus.CREATE, - type=PartitionType.Primary, + type=PartitionType.PRIMARY, start=home_start, length=home_length, mountpoint=Path('/home'), @@ -765,7 +765,7 @@ async def suggest_multi_disk_layout( # add root partition to the root device root_partition = PartitionModification( status=ModificationStatus.CREATE, - type=PartitionType.Primary, + type=PartitionType.PRIMARY, start=root_start, length=root_length, mountpoint=Path('/'), @@ -787,7 +787,7 @@ async def suggest_multi_disk_layout( # add home partition to home device home_partition = PartitionModification( status=ModificationStatus.CREATE, - type=PartitionType.Primary, + type=PartitionType.PRIMARY, start=home_start, length=home_length, mountpoint=Path('/home'), diff --git a/archinstall/lib/disk/partitioning_menu.py b/archinstall/lib/disk/partitioning_menu.py index d5c6f0648d..7e07d776cd 100644 --- a/archinstall/lib/disk/partitioning_menu.py +++ b/archinstall/lib/disk/partitioning_menu.py @@ -58,7 +58,7 @@ def table_data(self) -> dict[str, str]: part_mod = PartitionModification( status=ModificationStatus.CREATE, - type=PartitionType._Unknown, + type=PartitionType._UNKNOWN, start=self.segment.start, length=self.segment.length, ) @@ -527,7 +527,7 @@ async def _create_new_partition(self, free_space: FreeSpace) -> PartitionModific partition = PartitionModification( status=ModificationStatus.CREATE, - type=PartitionType.Primary, + type=PartitionType.PRIMARY, start=free_space.start, length=length, fs_type=fs_type, diff --git a/archinstall/lib/models/device.py b/archinstall/lib/models/device.py index 897a32bcf7..4d00019c84 100644 --- a/archinstall/lib/models/device.py +++ b/archinstall/lib/models/device.py @@ -721,22 +721,22 @@ def __hash__(self) -> int: class PartitionType(Enum): - Boot = 'boot' - Primary = 'primary' - _Unknown = 'unknown' + BOOT = 'boot' + PRIMARY = 'primary' + _UNKNOWN = 'unknown' @classmethod def get_type_from_code(cls, code: int) -> Self: if code == parted.PARTITION_NORMAL: - return cls.Primary + return cls.PRIMARY else: debug(f'Partition code not supported: {code}') - return cls._Unknown + return cls._UNKNOWN def get_partition_code(self) -> int | None: - if self == PartitionType.Primary: + if self == PartitionType.PRIMARY: return parted.PARTITION_NORMAL - elif self == PartitionType.Boot: + elif self == PartitionType.BOOT: return parted.PARTITION_BOOT return None diff --git a/docs/examples/python.rst b/docs/examples/python.rst index 84fb57c038..1243aca5d6 100644 --- a/docs/examples/python.rst +++ b/docs/examples/python.rst @@ -64,7 +64,7 @@ After running ``python -m archinstall test_installer`` it should print something _PartitionInfo( partition=, name='primary', - type=, + type=, fs_type=, path='/dev/nvme0n1p1', start=Size(value=2048, unit=, sector_size=SectorSize(value=512, unit=)), diff --git a/examples/full_automated_installation.py b/examples/full_automated_installation.py index cd74962a95..d4517795e8 100644 --- a/examples/full_automated_installation.py +++ b/examples/full_automated_installation.py @@ -38,7 +38,7 @@ # create a new boot partition boot_partition = PartitionModification( status=ModificationStatus.CREATE, - type=PartitionType.Primary, + type=PartitionType.PRIMARY, start=Size(1, Unit.MiB, device.device_info.sector_size), length=Size(512, Unit.MiB, device.device_info.sector_size), mountpoint=Path('/boot'), @@ -50,7 +50,7 @@ # create a root partition root_partition = PartitionModification( status=ModificationStatus.CREATE, - type=PartitionType.Primary, + type=PartitionType.PRIMARY, start=Size(513, Unit.MiB, device.device_info.sector_size), length=Size(20, Unit.GiB, device.device_info.sector_size), mountpoint=None, @@ -65,7 +65,7 @@ # create a new home partition home_partition = PartitionModification( status=ModificationStatus.CREATE, - type=PartitionType.Primary, + type=PartitionType.PRIMARY, start=start_home, length=length_home, mountpoint=Path('/home'), From 271b64deda4bf81e53b5998e132a3375bf32434d Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Wed, 15 Apr 2026 08:18:52 -0400 Subject: [PATCH 2/2] Use StrEnum for PartitionType --- archinstall/lib/models/device.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archinstall/lib/models/device.py b/archinstall/lib/models/device.py index 4d00019c84..74fb7e777b 100644 --- a/archinstall/lib/models/device.py +++ b/archinstall/lib/models/device.py @@ -720,9 +720,9 @@ def __hash__(self) -> int: return hash(self.disk.device.path) -class PartitionType(Enum): - BOOT = 'boot' - PRIMARY = 'primary' +class PartitionType(StrEnum): + BOOT = auto() + PRIMARY = auto() _UNKNOWN = 'unknown' @classmethod