File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,16 @@ def __str__(self):
2121 import pybind11
2222 return pybind11 .get_include (self .user )
2323
24+ class get_numpy_include (object ):
25+ """Helper class to determine the numpy include path
26+
27+ The purpose of this class is to postpone importing numpy
28+ until it is actually installed, so that the ``get_include()``
29+ method can be invoked. """
30+
31+ def __str__ (self ):
32+ import numpy
33+ return numpy .get_include ()
2434
2535ext_modules = [
2636 Extension (
@@ -30,6 +40,8 @@ def __str__(self):
3040 # Path to pybind11 headers
3141 get_pybind_include (),
3242 get_pybind_include (user = True ),
43+ # Path to numpy headers
44+ get_numpy_include (),
3345 os .path .join (sys .prefix , 'include' ),
3446 os .path .join (sys .prefix , 'Library' , 'include' )
3547 ],
Original file line number Diff line number Diff line change @@ -21,6 +21,16 @@ def __str__(self):
2121 import pybind11
2222 return pybind11 .get_include (self .user )
2323
24+ class get_numpy_include (object ):
25+ """Helper class to determine the numpy include path
26+
27+ The purpose of this class is to postpone importing numpy
28+ until it is actually installed, so that the ``get_include()``
29+ method can be invoked. """
30+
31+ def __str__ (self ):
32+ import numpy
33+ return numpy .get_include ()
2434
2535ext_modules = [
2636 Extension (
@@ -30,6 +40,8 @@ def __str__(self):
3040 # Path to pybind11 headers
3141 get_pybind_include (),
3242 get_pybind_include (user = True ),
43+ # Path to numpy headers
44+ get_numpy_include (),
3345 os .path .join (sys .prefix , 'include' ),
3446 os .path .join (sys .prefix , 'Library' , 'include' )
3547 ],
You can’t perform that action at this time.
0 commit comments