Skip to content

Commit bc34f84

Browse files
committed
Add project root folder to include_dirs in _cython_api setup script
Add project root folder to include_dirs in the setup_cython_api.py so that Cython can find dpctl/__init__.pxd This resolves gh-2146 for me locally with Cython 3.1.3
1 parent 52ab452 commit bc34f84

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

dpctl/tests/setup_cython_api.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,25 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
import os.path
1718
import setuptools
1819
from Cython.Build import build_ext
1920

2021
import dpctl
2122

23+
def get_includes():
24+
# path to dpctl/include
25+
dpctl_incl_dir = dpctl.get_include()
26+
# path to folder where __init__.pxd resides
27+
dpctl_pxd_dir = os.path.dirname(
28+
os.path.dirname(dpctl_incl_dir))
29+
return [dpctl_incl_dir, dpctl_pxd_dir]
30+
31+
2232
ext = setuptools.Extension(
2333
"_cython_api",
2434
["_cython_api.pyx"],
25-
include_dirs=[dpctl.get_include()],
35+
include_dirs=get_includes(),
2636
language="c++",
2737
)
2838

0 commit comments

Comments
 (0)