mirror of
https://github.com/fastapi/fastapi.git
synced 2026-05-24 08:16:11 -04:00
🔧 Upgrade Material for MkDocs and remove insiders (#14375)
This commit is contained in:
committed by
GitHub
parent
325fd16d32
commit
be5a6311f5
@@ -4,9 +4,7 @@ import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
from functools import lru_cache
|
||||
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
||||
from importlib import metadata
|
||||
from multiprocessing import Pool
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
@@ -47,12 +45,6 @@ build_site_path = Path("site_build").absolute()
|
||||
header_with_permalink_pattern = re.compile(r"^(#{1,6}) (.+?)(\s*\{\s*#.*\s*\})\s*$")
|
||||
|
||||
|
||||
@lru_cache
|
||||
def is_mkdocs_insiders() -> bool:
|
||||
version = metadata.version("mkdocs-material")
|
||||
return "insiders" in version
|
||||
|
||||
|
||||
def get_en_config() -> Dict[str, Any]:
|
||||
return mkdocs.utils.yaml_load(en_config_path.read_text(encoding="utf-8"))
|
||||
|
||||
@@ -77,9 +69,7 @@ def complete_existing_lang(incomplete: str):
|
||||
|
||||
@app.callback()
|
||||
def callback() -> None:
|
||||
if is_mkdocs_insiders():
|
||||
os.environ["INSIDERS_FILE"] = "../en/mkdocs.insiders.yml"
|
||||
# For MacOS with insiders and Cairo
|
||||
# For MacOS with Cairo
|
||||
os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/homebrew/lib"
|
||||
|
||||
|
||||
@@ -115,10 +105,6 @@ def build_lang(
|
||||
"""
|
||||
Build the docs for a language.
|
||||
"""
|
||||
insiders_env_file = os.environ.get("INSIDERS_FILE")
|
||||
print(f"Insiders file {insiders_env_file}")
|
||||
if is_mkdocs_insiders():
|
||||
print("Using insiders")
|
||||
lang_path: Path = Path("docs") / lang
|
||||
if not lang_path.is_dir():
|
||||
typer.echo(f"The language translation doesn't seem to exist yet: {lang}")
|
||||
|
||||
Reference in New Issue
Block a user