Skip to content

comicbox.box.archive.attributes

Give a copy of a comic what the comic had beside its bytes.

A write that replaces a comic with a patched copy keeps the comic’s mode, its owner and group where this process may set them, and its extended attributes where the standard library can read them: on Linux, not on macOS or Windows.

keep_attributes(source, copy)

Give a copy the comic’s extended attributes, owner, group and mode.

Source code in comicbox/box/archive/attributes.py
49
50
51
52
53
54
55
def keep_attributes(source: Path, copy: Path) -> None:
    """Give a copy the comic's extended attributes, owner, group and mode."""
    source_stat = source.stat()
    _keep_xattrs(source, copy)
    _keep_owner(source_stat, copy)
    # After the owner: a change of owner can clear the set-id bits.
    copy.chmod(stat.S_IMODE(source_stat.st_mode))