_toolchain.cxx: use distutils from setuptools.

The distutils module from the standard library is deprecated and will
be removed in Python 3.12, and PEP 632 recommends using
distutils.ccompiler from setuptools, instead.

This code should eventually be rewritten to use zig-pypi, but for now
this suffices.
This commit is contained in:
whitequark 2021-10-08 17:48:00 +00:00
parent 97aa7a3aa9
commit 8081df1265

View file

@ -1,7 +1,7 @@
import tempfile
import sysconfig
import os.path
from distutils import ccompiler
from setuptools import distutils
__all__ = ["build_cxx"]
@ -17,7 +17,7 @@ def build_cxx(*, cxx_sources, output_name, include_dirs, macros):
# the output directory directly.
os.chdir(build_dir.name)
cc_driver = ccompiler.new_compiler()
cc_driver = distutils.ccompiler.new_compiler()
cc_driver.output_dir = "."
cc = sysconfig.get_config_var("CC")