From 6479c3b76bc6a01ccf5d6300e9c433567ab21888 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 25 Jan 2025 18:23:34 +1100 Subject: [PATCH] Only import distutils when type checking --- setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 55e71959a2a..ba510d57c2b 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,6 @@ # ------------------------------ from __future__ import annotations -import distutils.ccompiler import os import re import shutil @@ -18,12 +17,15 @@ import tempfile import warnings from collections.abc import Iterator -from typing import Any +from typing import TYPE_CHECKING, Any from setuptools import Extension, setup from setuptools.command.build_ext import build_ext from setuptools.errors import CompileError +if TYPE_CHECKING: + import distutils.ccompiler + def get_version() -> str: version_file = "src/PIL/_version.py"