diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2022-12-14 17:33:15 +0100 |
---|---|---|
committer | Jose M. Guisado <jguisado@soleta.eu> | 2022-12-15 17:37:07 +0100 |
commit | bc6f5cbdffe19c62fd69791ea5e19a1900442adc (patch) | |
tree | 7c8d95eb062e3bb8713ce08eb2f3943d0ed66782 /COPYING | |
parent | 5eba6d4d65fb5a633f7d0c67a308410a97b6a3ad (diff) |
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>
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions