From ecdae56d4a316ccb98229e7a4d3f3bd35995b2ab Mon Sep 17 00:00:00 2001 From: Mario Mulansky Date: Thu, 25 Apr 2024 04:12:17 +0000 Subject: [PATCH] Fix numpy include error with Cython 3 #68 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`. --- setup.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index a77af2d..b52cf8b 100644 --- a/setup.py +++ b/setup.py @@ -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 \