Fix command detection when a command string contains multiple words.

This commit is contained in:
David Given
2025-08-27 00:11:57 +02:00
parent 8194a08382
commit 273d38f237
2 changed files with 10 additions and 10 deletions

View File

@@ -12,6 +12,7 @@ from os.path import relpath, splitext, join, basename, isfile
from glob import iglob
import fnmatch
import subprocess
import shutil
def filenamesmatchingof(xs, pattern):
@@ -52,6 +53,11 @@ def itemsof(pattern, root=None, cwd=None):
return result
def does_command_exist(cmd):
basecmd = cmd.strip().split()[0]
return shutil.which(basecmd)
def shell(args):
r = subprocess.check_output(args)
return r.decode("utf-8").strip()

View File

@@ -1,25 +1,19 @@
from build.ab import simplerule, G
from build.c import cxxprogram
from build.utils import shell
from build.utils import shell, does_command_exist
from glob import glob
import config
import shutil
import subprocess
G.setdefault("WX_CONFIG", "wx-config")
assert shutil.which(G.WX_CONFIG), "Required binary 'wx-config' not found"
assert does_command_exist(G.WX_CONFIG), "Required binary 'wx-config' not found"
G.setdefault(
"WX_CFLAGS",
shell(
[G.WX_CONFIG, "--cxxflags", "base", "adv", "aui", "richtext", "core"]
),
shell([G.WX_CONFIG, "--cxxflags", "base", "adv", "aui", "richtext", "core"]),
)
G.setdefault(
"WX_LDFLAGS",
shell(
[G.WX_CONFIG, "--libs", "base", "adv", "aui", "richtext", "core"]
)
shell([G.WX_CONFIG, "--libs", "base", "adv", "aui", "richtext", "core"]),
)
extrasrcs = ["./layout.cpp"]