Fix qa_cli running on macOS with the KICAD_RUN_FROM_BUILD_DIR flag set

This commit is contained in:
Jon Evans
2024-12-01 15:05:41 -05:00
parent 1198233464
commit 5cdff00e98
+16 -1
View File
@@ -21,6 +21,9 @@
#
import difflib
import os
import platform
import cairosvg
import logging
import subprocess
@@ -35,14 +38,26 @@ Image.MAX_IMAGE_PIXELS = 800 * 1024 * 1024 // 4 # Increase limit to ~800MB uncom
def run_and_capture( command: list ) -> Tuple[ str, str, int ]:
logger.info("Executing command \"%s\"", " ".join( command ))
# MacOS qa_cli uses the installed kicad-cli
if platform.system() == "Darwin":
env = {}
env.update(os.environ)
env.pop('KICAD_RUN_FROM_BUILD_DIR')
proc = subprocess.Popen( command,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
encoding = 'utf-8'
encoding = 'utf-8',
env = env
)
out,err = proc.communicate()
if proc.returncode != 0 or len(err) != 0:
logger.info(f"command returned {proc.returncode}")
logger.info(f"stdout: {out}")
logger.info(f"stderr: {err}")
return out, err, proc.returncode
def textdiff_files( golden_filepath: str, new_filepath: str, skip: int = 0 ) -> bool: