Skip to content

Commit

Permalink
MAINT: Add NumPy include dir during build
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Feb 8, 2024
1 parent 8ae6e5c commit 7145893
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tvtk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 7145893

Please sign in to comment.