Skip to content

Commit

Permalink
Fix numpy include error with Cython 3 #68 (#81)
Browse files Browse the repository at this point in the history
Fixes compilation error with Cython 3 by making `numpy_include` behave
like an `os.PathLike`. That is needed because Cython 3 is passing
the `numpy_include` instance directly to `os.path.join`.
  • Loading branch information
mariomulansky authored Apr 25, 2024
1 parent a90a33c commit 56464c6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@


class numpy_include(os.PathLike):
"""Defers import of numpy until install_requires is through"""
def __fspath__(self):
import numpy
return numpy.get_include()
"""Defers import of numpy until install_requires is through"""
def __str__(self):
import numpy
return numpy.get_include()

def __fspath__(self):
return str(self)


if os.path.isfile("pyspike/cython/cython_add.c") and \
Expand Down

0 comments on commit 56464c6

Please sign in to comment.