Skip to content

Commit 25bd25a

Browse files
committed
fix mypy failure after multiple merges
1 parent 39179c1 commit 25bd25a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

setuptools/command/install.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import inspect
55
import platform
66
from collections.abc import Callable
7-
from typing import Any, ClassVar, cast
7+
from typing import TYPE_CHECKING, Any, ClassVar, cast
88

99
import setuptools
1010

@@ -15,6 +15,12 @@
1515
import distutils.command.install as orig
1616
from distutils.errors import DistutilsArgError
1717

18+
if TYPE_CHECKING:
19+
# This is only used for a type-cast, don't import at runtime or it'll cause deprecation warnings
20+
from .easy_install import easy_install as easy_install_cls
21+
else:
22+
easy_install_cls = None
23+
1824
# Prior to numpy 1.9, NumPy relies on the '_install' name, so provide it for
1925
# now. See https://github.com/pypa/setuptools/issues/199/
2026
_install = orig.install
@@ -131,7 +137,9 @@ def _called_from_setup(run_frame):
131137
return False
132138

133139
def do_egg_install(self) -> None:
134-
easy_install = self.distribution.get_command_class('easy_install')
140+
easy_install = cast(
141+
type[easy_install_cls], self.distribution.get_command_class('easy_install')
142+
)
135143

136144
cmd = easy_install(
137145
self.distribution,

0 commit comments

Comments
 (0)