okami.mom/albedo
git clone https://git.nkp.pet/okami.mom/albedo
c3dc8ec
main
1"""Content hash of the packaged python tree. 2 3The remote plugin stages a bundle under this hash, and a detached kernel and 4its bridge announce it, so the daemon can tell when a kernel runs older code 5than the daemon's own tree. 6""" 7 8from __future__import annotations 9 10import hashlib 11from pathlib import Path 12 13ROOT = Path (__file__ ).resolve ().parent 14 15 16def digest (root :Path = ROOT )-> str : 17"""sha256 over every .py file's relative path and bytes, in path order.""" 18hasher = hashlib .sha256 () 19for path in sorted (root .rglob ("*.py" )): 20hasher .update (str (path .relative_to (root )).encode ()) 21hasher .update (path .read_bytes ()) 22return hasher .hexdigest ()