git: c3d7b96df0ac - stable/14 - tools/build/make.py: Avoid Python 3.7+ subprocess.run capture_output

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Sat, 07 Sep 2024 01:48:10 UTC
The branch stable/14 has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=c3d7b96df0acd640a538c493ec03d5452fac216f

commit c3d7b96df0acd640a538c493ec03d5452fac216f
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2024-01-31 19:45:59 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2024-09-07 00:20:39 +0000

    tools/build/make.py: Avoid Python 3.7+ subprocess.run capture_output
    
    This is just a convenient alias for setting stdout and stderr to PIPE,
    so substitute it for that to be compatible with Python 3.6.
    
    Fixes:  69cfdc81ea7b ("tools/build/make.py: Keep bootstrapped bmake binary up-to-date")
    
    (cherry picked from commit b771d5705fc95445d4d81e054be664b7842156ff)
---
 tools/build/make.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/build/make.py b/tools/build/make.py
index a602cc22072c..ec42cb70dd21 100755
--- a/tools/build/make.py
+++ b/tools/build/make.py
@@ -81,8 +81,8 @@ def bootstrap_bmake(source_root, objdir_prefix):
     bmake_config = bmake_install_dir / ".make-py-config"
 
     bmake_source_version = subprocess.run([
-        "sh", "-c", ". \"$0\"/VERSION; echo $_MAKE_VERSION",
-        bmake_source_dir], capture_output=True).stdout.strip()
+        "sh", "-c", ". \"$0\"/VERSION; echo $_MAKE_VERSION", bmake_source_dir],
+        stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.strip()
     try:
         bmake_source_version = int(bmake_source_version)
     except ValueError:
@@ -92,7 +92,7 @@ def bootstrap_bmake(source_root, objdir_prefix):
     if bmake_binary.exists():
         bmake_installed_version = subprocess.run([
             bmake_binary, "-r", "-f", "/dev/null", "-V", "MAKE_VERSION"],
-            capture_output=True).stdout.strip()
+            stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.strip()
         try:
             bmake_installed_version = int(bmake_installed_version.strip())
         except ValueError:
@@ -187,8 +187,9 @@ def default_cross_toolchain():
     # default to homebrew-installed clang on MacOS if available
     if sys.platform.startswith("darwin"):
         if shutil.which("brew"):
-            llvm_dir = subprocess.run(["brew", "--prefix", "llvm"],
-                                      capture_output=True).stdout.strip()
+            llvm_dir = subprocess.run([
+                "brew", "--prefix", "llvm"],
+                stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.strip()
             debug("Inferred LLVM dir as", llvm_dir)
             try:
                 if llvm_dir and Path(llvm_dir.decode("utf-8"), "bin").exists():