From 35d230ae7636c32d3fbe217d76cc7bbb47b3c24a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 10 Jan 2022 21:14:56 +0100 Subject: [PATCH] less distutils in env.py and features --- src/sage/env.py | 4 ++-- src/sage/features/__init__.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sage/env.py b/src/sage/env.py index c4953cfa654..178e678f650 100644 --- a/src/sage/env.py +++ b/src/sage/env.py @@ -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()) diff --git a/src/sage/features/__init__.py b/src/sage/features/__init__.py index 8ab6372c221..7505ad3d1a2 100644 --- a/src/sage/features/__init__.py +++ b/src/sage/features/__init__.py @@ -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.")