From 4c20f8cf4bd1ba3032cf2c6098f50f13a7fbcb5c Mon Sep 17 00:00:00 2001 From: Mike Purvis Date: Wed, 10 Apr 2024 13:32:21 -0400 Subject: [PATCH] Avoid build time spam on Python 3.11 --- cmake/interrogate_setup_dot_py.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmake/interrogate_setup_dot_py.py b/cmake/interrogate_setup_dot_py.py index 5e25fbf8a..858174ad7 100644 --- a/cmake/interrogate_setup_dot_py.py +++ b/cmake/interrogate_setup_dot_py.py @@ -39,11 +39,14 @@ setup_modules = [] -try: - import distutils.core - setup_modules.append(distutils.core) -except ImportError: - pass +# Importing distutils on Python 3.11 emits warnings into the console +# and on 3.12 it will be removed altogether. +if sys.version_info[:2] < (3, 11): + try: + import distutils.core + setup_modules.append(distutils.core) + except ImportError: + pass try: import setuptools