INNER CODE UNIT · Python

render

XRPLF/rippled · package/build_pkg.py:126

def render(template: Path, dest: Path, values: dict[str, str]) -> None:
    """Write template to dest with its @TOKEN@ placeholders substituted.

    A token left without a value fails the build rather than reaching dpkg.
    """
    text = template.read_text()
    for token, value in values.items():
        text = text.replace(f"@{token}@", value)

    missing = sorted(set(TOKEN.findall(text)))
    assert not missing, f"{template}: no value for {', '.join(missing)}"

    # An empty value at the end of a stanza would otherwise leave a blank line,
    # which is what ends a stanza.
    dest.write_text(text.rstrip("\n") + "\n")


def package_name(variant: str) -> str:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…