Skip to content

Commit 6479c3b

Browse files
committed
Only import distutils when type checking
1 parent b9ac9ce commit 6479c3b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# ------------------------------
99
from __future__ import annotations
1010

11-
import distutils.ccompiler
1211
import os
1312
import re
1413
import shutil
@@ -18,12 +17,15 @@
1817
import tempfile
1918
import warnings
2019
from collections.abc import Iterator
21-
from typing import Any
20+
from typing import TYPE_CHECKING, Any
2221

2322
from setuptools import Extension, setup
2423
from setuptools.command.build_ext import build_ext
2524
from setuptools.errors import CompileError
2625

26+
if TYPE_CHECKING:
27+
import distutils.ccompiler
28+
2729

2830
def get_version() -> str:
2931
version_file = "src/PIL/_version.py"

0 commit comments

Comments
 (0)