Files
cibuildwheel/docs/main.py
T

19 lines
530 B
Python
Raw Normal View History

from __future__ import annotations
2024-05-13 23:40:34 -04:00
import os
import subprocess
2024-05-13 23:40:34 -04:00
import sysconfig
from typing import Any
def define_env(env: Any) -> None:
"Hook function for mkdocs-macros"
@env.macro
def subprocess_run(*args: str) -> str:
"Run a subprocess and return the stdout"
2024-05-13 23:40:34 -04:00
env = os.environ.copy()
scripts = sysconfig.get_path("scripts")
env["PATH"] = f"{scripts}{os.pathsep}{env.get('PATH', '')}"
return subprocess.run(args, check=True, capture_output=True, text=True, env=env).stdout