Files
cibuildwheel/docs/main.py
T

17 lines
516 B
Python
Raw Normal View History

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"
2024-10-22 10:16:59 -04:00
@env.macro # type: ignore[misc]
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