Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
less distutils in env.py and features
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Jan 10, 2022
1 parent 3832350 commit 35d230a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/sage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,12 @@ 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
import sysconfig

TOP = SAGE_SRC if use_sources else SAGE_LIB

dirs = [TOP,
distutils.sysconfig.get_python_inc()]
sysconfig.get_config_var('INCLUDEPY')]
try:
import numpy
dirs.append(numpy.get_include())
Expand Down
3 changes: 1 addition & 2 deletions src/sage/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,13 +634,12 @@ def _is_present(self):
FeatureTestResult('empty', True)
"""
from sage.misc.temporary_file import tmp_filename
from distutils.errors import CCompilerError
with open(tmp_filename(ext=".pyx"), 'w') as pyx:
pyx.write(self.test_code)
from sage.misc.cython import cython_import
try:
cython_import(pyx.name, verbose=-1)
except CCompilerError:
except RuntimeError:
return FeatureTestResult(self, False, reason="Failed to compile test code.")
except ImportError:
return FeatureTestResult(self, False, reason="Failed to import test code.")
Expand Down

0 comments on commit 35d230a

Please sign in to comment.