meson: Improve/fix Python version selection
authorPeter Eisentraut <[email protected]>
Thu, 30 Nov 2023 06:22:51 +0000 (07:22 +0100)
committerPeter Eisentraut <[email protected]>
Thu, 30 Nov 2023 06:27:17 +0000 (07:27 +0100)
When we look for the Python installation using the meson python
module, we should make it use the python program previously determined
by the 'PYTHON' option.  Otherwise, it will just use its own search
and the 'PYTHON' option won't affect it.  We need this to be able to
select the Python installation to build PL/Python against.

Reviewed-by: Andres Freund <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/3f5427e8-cef6-474d-ae88-13db1bfdc1a7%40eisentraut.org

meson.build

index 0095fb183afeb2d98765c626673661375e888c48..f77d69675807a96c8315d0b2c8f1c6fc9e7c8803 100644 (file)
@@ -1063,7 +1063,7 @@ pyopt = get_option('plpython')
 python3_dep = not_found_dep
 if not pyopt.disabled()
   pm = import('python')
-  python3_inst = pm.find_installation(required: pyopt)
+  python3_inst = pm.find_installation(python.path(), required: pyopt)
   if python3_inst.found()
     python3_dep = python3_inst.dependency(embed: true, required: pyopt)
     # Remove this check after we depend on Meson >= 1.1.0