Skip to content

Commit

Permalink
gh-35118: sage.env.sage_include_directories: Don't use distutils
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Release Manager committed Mar 24, 2023
2 parents 8c79fac + 5ece0c8 commit e6be37b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/sage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,20 @@ def sage_include_directories(use_sources=False):
sage: any(os.path.isfile(os.path.join(d, file)) for d in dirs)
True
"""
import distutils.sysconfig

TOP = SAGE_SRC if use_sources else SAGE_LIB

dirs = [TOP,
distutils.sysconfig.get_python_inc()]
if use_sources:
dirs = [SAGE_SRC]
else:
import sage
dirs = [os.path.dirname(directory)
for directory in sage.__path__]
try:
import numpy
dirs.insert(1, numpy.get_include())
dirs.append(numpy.get_include())
except ModuleNotFoundError:
pass

dirs.append(sysconfig.get_config_var('INCLUDEPY'))

return dirs

def get_cblas_pc_module_name() -> str:
Expand Down

0 comments on commit e6be37b

Please sign in to comment.