_toolchain.cxx: ignore another deprecation warning (on Python 3.10).
authorwhitequark <whitequark@whitequark.org>
Fri, 8 Oct 2021 17:48:00 +0000 (17:48 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 31 Dec 2021 19:51:36 +0000 (19:51 +0000)
Sigh.

nmigen/_toolchain/cxx.py

index c43ffbc44c73d66906288bd65bc216104e5551e4..439011cbc14390a4c04c74ad0fe104750e903dca 100644 (file)
@@ -4,12 +4,6 @@ import warnings
 import os.path
 
 
-with warnings.catch_warnings():
-    warnings.filterwarnings(action="ignore", category=DeprecationWarning)
-    # this causes a DeprecationWarning on Python 3.6 (but not later)
-    from setuptools import distutils
-
-
 __all__ = ["build_cxx"]
 
 
@@ -23,7 +17,12 @@ def build_cxx(*, cxx_sources, output_name, include_dirs, macros):
         # the output directory directly.
         os.chdir(build_dir.name)
 
-        cc_driver = distutils.ccompiler.new_compiler()
+        with warnings.catch_warnings():
+            warnings.filterwarnings(action="ignore", category=DeprecationWarning)
+            # This emits a DeprecationWarning on Python 3.6 and 3.10.
+            from setuptools import distutils
+            cc_driver = distutils.ccompiler.new_compiler()
+
         cc_driver.output_dir = "."
 
         cc = sysconfig.get_config_var("CC")