From a9f1c35cb118b51196d901a44f8f299461ce7442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcelina=20Ko=C5=9Bcielnicka?= Date: Wed, 26 Oct 2022 00:34:24 +0200 Subject: [PATCH] _toolchain.cxx: fix use of distutils.ccompiler on newer setuptools. Starting with setuptools 64.0.2, the monkeypatching process performed as part of its bootstrap no longer imports distutils.ccompiler, causing an AttributeError. --- amaranth/_toolchain/cxx.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/amaranth/_toolchain/cxx.py b/amaranth/_toolchain/cxx.py index ffe5bfc..1608c0b 100644 --- a/amaranth/_toolchain/cxx.py +++ b/amaranth/_toolchain/cxx.py @@ -20,8 +20,9 @@ def build_cxx(*, cxx_sources, output_name, include_dirs, macros): with warnings.catch_warnings(): warnings.filterwarnings(action="ignore", category=DeprecationWarning) # This emits a DeprecationWarning on Python 3.10. - from setuptools import distutils - cc_driver = distutils.ccompiler.new_compiler() + import setuptools + from distutils import ccompiler + cc_driver = ccompiler.new_compiler() cc_driver.output_dir = "."