manim/scripts/make_and_open_docs.py
Achille Fouilleul 0a96aacb24
os.system -> subprocess (#3955)
Quoting the python library documentation:

> The subprocess module provides more powerful facilities for spawning
> new processes and retrieving their results; using that module is
> preferable to using this function.
2024-10-15 20:43:02 -03:00

15 lines
480 B
Python

from __future__ import annotations
import subprocess
import sys
import webbrowser
from pathlib import Path
path_makefile = Path(__file__).resolve().parents[1] / "docs"
subprocess.run(["make", "html"], cwd=path_makefile)
website = (path_makefile / "build" / "html" / "index.html").absolute().as_uri()
try: # Allows you to pass a custom browser if you want.
webbrowser.get(sys.argv[1]).open_new_tab(f"{website}")
except IndexError:
webbrowser.open_new_tab(f"{website}")