Skip to content

Commit

Permalink
fix mypy failure after multiple merges
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Nov 1, 2024
1 parent 39179c1 commit 34b53eb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions setuptools/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import inspect
import platform
from collections.abc import Callable
from typing import Any, ClassVar, cast
from typing import TYPE_CHECKING, Any, ClassVar, cast

import setuptools

Expand All @@ -15,6 +15,12 @@
import distutils.command.install as orig
from distutils.errors import DistutilsArgError

if TYPE_CHECKING:
# This is only used for a type-cast, don't import at runtime or it'll cause deprecation warnings
from .easy_install import easy_install as easy_install_cls
else:
easy_install_cls = type()

# Prior to numpy 1.9, NumPy relies on the '_install' name, so provide it for
# now. See https://github.com/pypa/setuptools/issues/199/
_install = orig.install
Expand Down Expand Up @@ -131,7 +137,9 @@ def _called_from_setup(run_frame):
return False

def do_egg_install(self) -> None:
easy_install = self.distribution.get_command_class('easy_install')
easy_install = cast(
type[easy_install_cls], self.distribution.get_command_class('easy_install')
)

cmd = easy_install(
self.distribution,
Expand Down

0 comments on commit 34b53eb

Please sign in to comment.