From a6eb5118b3aeadef44055f0df0d4879c19a5c685 Mon Sep 17 00:00:00 2001
From: Eric Larson <larson.eric.d@gmail.com>
Date: Thu, 8 Feb 2024 13:56:00 -0500
Subject: [PATCH] MAINT: Add NumPy include dir during build

---
 tvtk/setup.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tvtk/setup.py b/tvtk/setup.py
index 0531134c8..79e347671 100755
--- a/tvtk/setup.py
+++ b/tvtk/setup.py
@@ -8,6 +8,10 @@
 
 
 def can_compile_extensions():
+    try:
+        import numpy  # noqa
+    except Exception:
+        return False  # our extension needs numpy/arrayobject.h
     from distutils.dist import Distribution
     from distutils.errors import DistutilsError
     sargs = {'script_name': None, 'script_args': ["--build-ext"]}
@@ -62,10 +66,12 @@ def configuration(parent_package=None, top_path=None):
 
     # Add any extensions.  These are optional.
     if can_compile_extensions():
+        import numpy as np
         config.add_extension(
             'array_ext',
             sources=[join('src', 'array_ext.c')],
             depends=[join('src', 'array_ext.pyx')],
+            include_dirs=[np.get_include()],
         )
 
     tvtk_classes_zip_depends = config.paths(