From 6c7b3bde703014ccec91f3f6a8a7af21b36d0a1f Mon Sep 17 00:00:00 2001
From: Tristan Partin <tristan@neon.tech>
Date: Wed, 17 May 2023 09:40:02 -0500
Subject: [PATCH v1 1/7] Make finding pkg-config(python3) more robust

It is a possibility that the installation can't be found.
---
 meson.build | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index 5422885b0a..bd9cdb797e 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
 
 
-- 
Tristan Partin
Neon (https://neon.tech)

