embdgen.core.utils.image

Utility functions for working with images

class embdgen.core.utils.image.BuildLocation[source]

Bases: object

Temporary location of the builds

set_path(path: Path) None[source]
remove() None[source]
property path
embdgen.core.utils.image.create_empty_image(filename: Path, size: int) None[source]

Create an empty sparse (if possible) file

embdgen.core.utils.image.copy_sparse(out_file: BufferedIOBase, in_file: BufferedIOBase, size: int | None = None) None[source]

Copy sparse from in_file to out_file up to size bytes. This does not necessarily create the minimum sparse file. In the current implementation it only makes 4096 byte blocks of zeros sparse. If a block is shorter, it is actually written to the out_file. This is a time vs. space optimization. Checking if a fixed size block is empty can be implemented very fast in python, but checking if an arbitrarily long block is empty is not very efficient.

embdgen.core.utils.image.get_temp_file(ext: str = '') Path[source]