Skip to content

Commit e6be37b

Browse files
author
Release Manager
committed
gh-35118: `sage.env.sage_include_directories`: Don't use `distutils` and `SAGE_LIB` <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> ### 📚 Description <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If it resolves an open issue, please link to the issue here. For example "Closes #1337" --> Fixes #33137 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [x] I have made sure that the title is self-explanatory and the description concisely explains the PR. - [x] I have linked an issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open pull requests that this PR logically depends on --> <!-- - #xyz: short description why this is a dependency - #abc: ... --> URL: #35118 Reported by: Matthias Köppe Reviewer(s): François Bissey
2 parents 8c79fac + 5ece0c8 commit e6be37b

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/sage/env.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,17 +304,20 @@ def sage_include_directories(use_sources=False):
304304
sage: any(os.path.isfile(os.path.join(d, file)) for d in dirs)
305305
True
306306
"""
307-
import distutils.sysconfig
308-
309-
TOP = SAGE_SRC if use_sources else SAGE_LIB
310-
311-
dirs = [TOP,
312-
distutils.sysconfig.get_python_inc()]
307+
if use_sources:
308+
dirs = [SAGE_SRC]
309+
else:
310+
import sage
311+
dirs = [os.path.dirname(directory)
312+
for directory in sage.__path__]
313313
try:
314314
import numpy
315-
dirs.insert(1, numpy.get_include())
315+
dirs.append(numpy.get_include())
316316
except ModuleNotFoundError:
317317
pass
318+
319+
dirs.append(sysconfig.get_config_var('INCLUDEPY'))
320+
318321
return dirs
319322

320323
def get_cblas_pc_module_name() -> str:

0 commit comments

Comments
 (0)