Skip to content

Commit

Permalink
Update aksetup
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Apr 16, 2024
1 parent d608d05 commit d531b18
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions aksetup_helper.py
Expand Up @@ -43,14 +43,21 @@ def setup(*args, **kwargs):


def get_numpy_incpath():
from os.path import join, dirname
from os.path import join, dirname, exists
from importlib.util import find_spec
origin = find_spec("numpy").origin
if origin is None:
raise RuntimeError("origin of numpy package not found")

pathname = dirname(origin)
return join(pathname, "core", "include")
for p in [
join(pathname, "_core", "include"), # numpy 2 onward
join(pathname, "core", "include"), # numpy prior to 2
]:
if exists(join(p, "numpy", "arrayobject.h")):
return p

raise RuntimeError("no valid path for numpy found")


class NumpyExtension(Extension):
Expand Down

0 comments on commit d531b18

Please sign in to comment.