INNER CODE UNIT · Python
legal
mtkennerly/ludusavi · tasks.py:42
def legal(ctx):
version = get_version()
txt_name = f"ludusavi-v{version}-legal.txt"
txt_path = ROOT / "dist" / txt_name
try:
ctx.run(f'cargo lichking bundle --file "{txt_path}"', hide=True)
except Exception:
pass
raw = txt_path.read_text("utf8")
normalized = re.sub(r"C:\\Users\\[^\\]+", "~", raw)
txt_path.write_text(normalized, "utf8")
zip_path = ROOT / "dist" / f"ludusavi-v{version}-legal.zip"
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zip:
zip.write(txt_path, txt_name)
@task