aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2023-10-20 11:11:31 -0700
committerAndres Freund <andres@anarazel.de>2023-10-20 11:11:31 -0700
commit41da94fd5c7418838ec7c49456b69c462013ea57 (patch)
tree2591125606e0cdc93d8be7977b4243d6224c15c7
parent52f22cd4e894ea2ff6a8c497ef4268b2726a9da9 (diff)
downloadpostgresql-41da94fd5c7418838ec7c49456b69c462013ea57.tar.gz
postgresql-41da94fd5c7418838ec7c49456b69c462013ea57.zip
meson: Make detection of python more robust
Previously we errored out if no python installation could be found (but we did handle not having enough of python installed to build plpython against). Presumably nobody hit this so far, as python is likely installed due to meson requiring python. Author: Tristan Partin <tristan@neon.tech> Discussion: https://postgr.es/m/CSPIJVUDZFKX.3KHMOAVGF94RV@c3po Backpatch: 16-, where meson support was added
-rw-r--r--meson.build12
1 files changed, 7 insertions, 5 deletions
diff --git a/meson.build b/meson.build
index 862c955453f..2d516c8f372 100644
--- a/meson.build
+++ b/meson.build
@@ -1056,15 +1056,17 @@ endif
###############################################################
pyopt = get_option('plpython')
+python3_dep = not_found_dep
if not pyopt.disabled()
pm = import('python')
python3_inst = pm.find_installation(required: pyopt)
- python3_dep = python3_inst.dependency(embed: true, required: pyopt)
- if not cc.check_header('Python.h', dependencies: python3_dep, required: pyopt)
- python3_dep = not_found_dep
+ if python3_inst.found()
+ python3_dep = python3_inst.dependency(embed: true, required: pyopt)
+ # Remove this check after we depend on Meson >= 1.1.0
+ if not cc.check_header('Python.h', dependencies: python3_dep, required: pyopt)
+ python3_dep = not_found_dep
+ endif
endif
-else
- python3_dep = not_found_dep
endif