Skip to content

Commit

Permalink
Merge pull request numpy#20831 from bwoodsend/numpy-testing-depends-o…
Browse files Browse the repository at this point in the history
…n-distutils

BUG: Avoid importing numpy.distutils on import numpy.testing (numpy#20769)
  • Loading branch information
rgommers committed Jan 20, 2022
2 parents 4103281 + 5329456 commit d3dcb04
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions numpy/testing/_private/extbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import pathlib
import sys
import sysconfig
from numpy.distutils.ccompiler import new_compiler
from distutils.errors import CompileError

__all__ = ['build_and_import_extension', 'compile_extension_module']

Expand Down Expand Up @@ -53,6 +51,7 @@ def build_and_import_extension(
>>> assert not mod.test_bytes(u'abc')
>>> assert mod.test_bytes(b'abc')
"""
from distutils.errors import CompileError

body = prologue + _make_methods(functions, modname)
init = """PyObject *mod = PyModule_Create(&moduledef);
Expand Down Expand Up @@ -221,6 +220,7 @@ def _c_compile(cfile, outputfilename, include_dirs=[], libraries=[],
def build(cfile, outputfilename, compile_extra, link_extra,
include_dirs, libraries, library_dirs):
"cd into the directory where the cfile is, use distutils to build"
from numpy.distutils.ccompiler import new_compiler

compiler = new_compiler(force=1, verbose=2)
compiler.customize('')
Expand Down

0 comments on commit d3dcb04

Please sign in to comment.