INNER CODE UNIT · Python
command
varunsalian/debrify · tool/webdav_memory_stress/run.py:53
def command(*args, **kwargs):
return subprocess.run(args, check=True, text=True, **kwargs)
def capture(*args):
return command(*args, stdout=subprocess.PIPE).stdout
def input_fingerprint(context=None):
"""Hash each file once; a build context is the authoritative copied input."""
digest = hashlib.sha256()
inputs = [(str((HERE / name).relative_to(ROOT)), name) for name in BUILD_FILES]
inputs += [(f"lib/{name}", f"lib/{name}") for name in SOURCES]
hashes = {}
for repository_name, context_name in inputs:
path = ROOT / repository_name if context is None else context / context_name
contents = path.read_bytes()
digest.update(repository_name.encode())