Go to file
Jose M. Guisado bc6f5cbdff partition: add partition type getset
Partition type getset enables modifying and getting the type
of a give libfdisk partition.

The type of a partition is defined using PartType, which
can only be instanced via label specific functions
get_parttype_from_string or get_parttype_from_code.

For example, to set the type of a new partitions to 'EFI System':

>>> import fdisk
>>> pa = fdisk.Partition()
>>> pa.type
>>> cxt = fdisk.Context('./disk.bin', readonly=False)
>>> cxt.create_disklabel('gpt')
>>> efitype = cxt.label.get_parttype_from_string("c12a7328-f81f-11d2-ba4b-00a0c93ec93b")
>>> pa.type = efitype

Following the previous example, getting its current partition type:

>>> pa.type
<libfdisk.PartType object at 0x7f2f0a9a12d0, name=EFI System>
2022-12-15 17:37:07 +01:00
.gitignore Initial commit 2022-04-06 12:56:11 +02:00
COPYING Add COPYING and license headers 2022-04-07 17:03:34 +02:00
MANIFEST.in Add MANIFEST.in 2022-04-06 15:40:31 +02:00
context.c context: add add_partition method 2022-12-15 12:27:35 +01:00
fdisk.c parttype: add parttype class and functions 2022-12-15 17:37:07 +01:00
fdisk.h parttype: add parttype class and functions 2022-12-15 17:37:07 +01:00
label.c parttype: add parttype class and functions 2022-12-15 17:37:07 +01:00
partition.c partition: add partition type getset 2022-12-15 17:37:07 +01:00
parttype.c parttype: add parttype class and functions 2022-12-15 17:37:07 +01:00
setup.py parttype: add parttype class and functions 2022-12-15 17:37:07 +01:00