Always redirect pkg-config stderr to DEVNULL

This commit is contained in:
Andrew Murray 2023-01-29 19:43:13 +11:00
parent 1de6c958df
commit e2f61371c6

View File

@ -255,23 +255,21 @@ def _pkg_config(name):
try: try:
command_libs = [command, "--libs-only-L", name] command_libs = [command, "--libs-only-L", name]
command_cflags = [command, "--cflags-only-I", name] command_cflags = [command, "--cflags-only-I", name]
stderr = None
if keep_system: if keep_system:
command_libs.append("--keep-system-libs") command_libs.append("--keep-system-libs")
command_cflags.append("--keep-system-cflags") command_cflags.append("--keep-system-cflags")
stderr = subprocess.DEVNULL
if not DEBUG: if not DEBUG:
command_libs.append("--silence-errors") command_libs.append("--silence-errors")
command_cflags.append("--silence-errors") command_cflags.append("--silence-errors")
libs = re.split( libs = re.split(
r"(^|\s+)-L", r"(^|\s+)-L",
subprocess.check_output(command_libs, stderr=stderr) subprocess.check_output(command_libs, stderr=subprocess.DEVNULL)
.decode("utf8") .decode("utf8")
.strip(), .strip(),
)[::2][1:] )[::2][1:]
cflags = re.split( cflags = re.split(
r"(^|\s+)-I", r"(^|\s+)-I",
subprocess.check_output(command_cflags, stderr=stderr) subprocess.check_output(command_cflags, stderr=subprocess.DEVNULL)
.decode("utf8") .decode("utf8")
.strip(), .strip(),
)[::2][1:] )[::2][1:]