docs: Rewrite tools/build-docs in python.

Change the script to python. This is done
for the following reasons.
* It enables us to use the sanity_check.
* Later when we add warning to include
--clean flag we can use the pre-existing
WARNING from zulip_tools rather than using
terminal color codes.

TODO: Currently this script is slow as the
clean option is expensive so instead use only
html by default and clean only if --clean
option is passed.

Part of #17961.
This commit is contained in:
tushar912 2021-04-07 16:29:03 +05:30 committed by Tim Abbott
parent a1d0fa5cbb
commit 94afc72764
1 changed files with 22 additions and 3 deletions

View File

@ -1,3 +1,22 @@
#!/usr/bin/env bash
set -eu
make -C "$(dirname "$0")"/../docs clean html
#!/usr/bin/env python3
# check for the venv
from lib import sanity_check
sanity_check.check_venv(__file__)
import os
import sys
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(ZULIP_PATH)
from scripts.lib.zulip_tools import run
def main() -> None:
path = os.path.join(ZULIP_PATH, "docs")
run(["make", "clean", "html", "-C", path])
if __name__ == "__main__":
main()