chore: more modern nox (#1823)
* chore: more modern nox Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * docs: fix running from unsourced venv Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * docs: minor typo fix Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * docs: fix wrong link #1825 Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
+6
-3
@@ -1,10 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sysconfig
|
||||
from typing import Any
|
||||
|
||||
# Requires Python 3.7+
|
||||
|
||||
|
||||
def define_env(env: Any) -> None:
|
||||
"Hook function for mkdocs-macros"
|
||||
@@ -12,4 +12,7 @@ def define_env(env: Any) -> None:
|
||||
@env.macro
|
||||
def subprocess_run(*args: str) -> str:
|
||||
"Run a subprocess and return the stdout"
|
||||
return subprocess.run(args, check=True, capture_output=True, text=True).stdout
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user