Python API¶
gptsum: a tool to make disk images using GPT partitions self-verifiable.
Like isomd5sum.
This module exposes the functionality provided by the tool through a Python API.
- exception gptsum.VerificationFailure(expected: UUID, actual: UUID)¶
Exception raised when
verify()
fails.New in version 0.0.9.
- gptsum.calculate_expected_guid(*, fd: int | None = None, path: Path | None = None) UUID ¶
Calculate the expected checksum GUID of a disk image.
One of
fd
orpath
must be given.- Parameters:
fd – Readable file-descriptor to an image file
path – Path of a readable image file
- Returns:
Expected checksum GUID of the disk image
New in version 0.0.9.
- gptsum.embed(*, fd: int | None = None, path: Path | None = None) None ¶
Embed the calculated checksum GUID in an image file.
In essence a combination of
calculate_expected_guid()
andset_guid()
.One of
fd
orpath
must be given.- Parameters:
fd – Readable and writable file-descriptor to an image file
path – Path to a readable and writable image file
New in version 0.0.9.
- gptsum.get_guid(*, fd: int | None = None, path: Path | None = None) UUID ¶
Get the GUID of a disk image.
One of
fd
orpath
must be given.- Parameters:
fd – Readable file-descriptor to an image file
path – Path of a readable image file
- Returns:
GUID of the disk image
New in version 0.0.9.
- gptsum.set_guid(guid: UUID, *, fd: int | None = None, path: Path | None = None) None ¶
Set the GUID of a disk image.
One of
fd
orpath
must be given.- Parameters:
guid – GUID to write to the disk image
fd – Readable and writable file-descriptor to an image file
path – Path of a readable and writable image file
New in version 0.0.9.
- gptsum.verify(*, fd: int | None = None, path: Path | None = None) None ¶
Verify a GPT disk image GUID against the calculated checksum.
In essence a combination of
calculate_expected_guid()
andget_guid()
.One of
fd
orpath
must be given.- Parameters:
fd – Readable file-descriptor to an image file
path – Path to a readable image file
- Raises:
VerificationFailure – Current GUID and checksum mismatch
New in version 0.0.9.
- gptsum.__author__ = 'Nicolas Trangez'¶
Package author name.
New in version 0.0.9.
- gptsum.__contact__ = 'ikke@nicolast.be'¶
Package author contact e-mail address.
New in version 0.0.9.
- gptsum.__license__ = 'Apache-2.0'¶
Package license identifier.
New in version 0.0.9.
- gptsum.__version__ = '0.5.0'¶
Package version identifier.
New in version 0.0.1.