def build_pages()

in securedrop.py [0:0]


def build_pages(securedrop_url: str, securedrop_url_human: str, stage: str):
    # routing in Fastly requires the PROD pages to include securedrop/ before links to assets
    path = 'securedrop/' if stage == 'PROD' else ''

    if os.path.exists('./build'):
        shutil.rmtree('./build')
    os.makedirs('./build')

    passed = render_page(securedrop_url, securedrop_url_human, path=path, passes_healthcheck=True)
    failed = render_page(securedrop_url, securedrop_url_human, path=path, passes_healthcheck=False)

    index = open("build/index.html", "w")
    maintenance = open("build/maintenance.html", "w")

    index.write(passed)
    maintenance.write(failed)
    index.close()
    maintenance.close()