2026-01-18 03:29:42 +09:00
2026-01-18 03:29:42 +09:00
2026-01-18 03:29:42 +09:00
2026-01-17 14:13:43 +09:00
2026-01-17 14:13:43 +09:00
2026-01-18 03:29:42 +09:00
2026-01-17 14:13:43 +09:00
2026-01-17 14:13:43 +09:00
2026-01-17 14:13:43 +09:00

py-pwr

Minimal Python client for wharf/pwr files. It parses the wire format, protobuf messages, and can apply patch ops when you provide file index to path mappings.

Features

  • Read .pwr, .pws, .pwm, .pww files.
  • Iterate sync ops and bsdiff controls.
  • Apply patches for RSYNC and BSDIFF series using target/output file lists.
  • Optional decompression for brotli/zstd if the modules are installed.

Limitations

  • TLC container decoding is not included. You can pass a decoder to PatchReader/SignatureReader to parse the raw container bytes.

Usage

Patch inspection:

from pwr import PatchReader

with PatchReader.open("update.pwr") as reader:
    for entry in reader.iter_file_entries():
        if entry.is_rsync():
            for op in entry.sync_ops:
                pass
        elif entry.is_bsdiff():
            for ctrl in entry.bsdiff_controls:
                pass

Apply a patch (requires file index mappings):

from pwr import PatchReader, apply_patch

target_paths = [
    "old/file0.bin",
    "old/file1.bin",
]

output_paths = [
    "new/file0.bin",
    "new/file1.bin",
]

with PatchReader.open("update.pwr") as reader:
    apply_patch(reader, target_paths, output_paths)

Apply to folders (uses embedded TLC container paths):

from pwr import apply_patch_to_folders

apply_patch_to_folders("update.pwr", "old_folder", "new_folder")

Quick inspect:

python py-pwr/main.py path/to/file.pwr

Apply via CLI:

python py-pwr/main.py apply update.pwr /path/to/old_folder /path/to/new_folder
Description
No description provided
Readme 54 KiB
Languages
Python 100%