Skip to content

Commit c79ca04

Browse files
committed
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
1 parent 1ad3a7b commit c79ca04

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

meson.build

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,15 +1052,17 @@ endif
10521052
###############################################################
10531053

10541054
pyopt = get_option('plpython')
1055+
python3_dep = not_found_dep
10551056
if not pyopt.disabled()
10561057
pm = import('python')
10571058
python3_inst = pm.find_installation(required: pyopt)
1058-
python3_dep = python3_inst.dependency(embed: true, required: pyopt)
1059-
if not cc.check_header('Python.h', dependencies: python3_dep, required: pyopt)
1060-
python3_dep = not_found_dep
1059+
if python3_inst.found()
1060+
python3_dep = python3_inst.dependency(embed: true, required: pyopt)
1061+
# Remove this check after we depend on Meson >= 1.1.0
1062+
if not cc.check_header('Python.h', dependencies: python3_dep, required: pyopt)
1063+
python3_dep = not_found_dep
1064+
endif
10611065
endif
1062-
else
1063-
python3_dep = not_found_dep
10641066
endif
10651067

10661068

0 commit comments

Comments
 (0)