Skip to content

Commit 036d98c

Browse files
committed
MAINT: improve error reporting when meson --version fails
1 parent dc23cff commit 036d98c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mesonpy/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,10 +1000,12 @@ def _get_meson_command(
10001000
# a runtime check to verify that the build environment is setup correcly.
10011001
required_version = _parse_version_string(version)
10021002
try:
1003-
meson_version = subprocess.run(cmd + ['--version'], check=False, text=True, capture_output=True).stdout
1003+
r = subprocess.run(cmd + ['--version'], text=True, capture_output=True)
10041004
except FileNotFoundError as err:
10051005
raise ConfigError(f'meson executable "{meson}" not found') from err
1006-
1006+
if r.returncode != 0:
1007+
raise ConfigError(f'Could not execute meson: {r.stderr.strip()}')
1008+
meson_version = r.stdout.strip()
10071009
if _parse_version_string(meson_version) < required_version:
10081010
raise ConfigError(f'Could not find meson version {version} or newer, found {meson_version}.')
10091011

0 commit comments

Comments
 (0)