Skip to content

Commit 61753e0

Browse files
committed
src/sagemath_giac/meson.build: further --include-dir workarounds
To support sagelib installed via setuptools WITHOUT __init__.py, we bring back the --include-dir arguments for the elements of sys.path. This won't work for an editable install, but it does support one more case than we do now.
1 parent 2a4573f commit 61753e0

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/sagemath_giac/meson.build

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ cpython = declare_dependency(include_directories: inc_cpython)
6565
# ours that could reasonably be installed --editable, so I don't feel
6666
# too bad about this.
6767
#
68+
# In addition, we explicitly add each element of sys.path to the
69+
# include path. This would normally be the case, and it is required in
70+
# the one scenario where the "import sage" trick fails, namely when
71+
# the sage library is installed without __init__.py.
72+
#
6873
# Note: meson automatically quotes compiler args with spaces in them,
6974
# so you shouldn't try to quote the paths here. Instead we split the
7075
# --include-dir and path arguments into separate elements so that
@@ -74,9 +79,15 @@ cython_include_args = run_command(
7479
[
7580
'-c',
7681
'''
82+
import sys
83+
for p in sys.path:
84+
if p:
85+
print("--include-dir")
86+
print(p)
87+
7788
import sage
78-
from pathlib import Path
7989
if sage.__file__:
90+
from pathlib import Path
8091
print("--include-dir")
8192
print(Path(sage.__file__).parent.parent)
8293
'''.strip()

0 commit comments

Comments
 (0)