|
16 | 16 | from collections.abc import Iterable, Sequence |
17 | 17 | from email.generator import BytesGenerator |
18 | 18 | from glob import iglob |
19 | | -from typing import Literal, cast |
| 19 | +from typing import TYPE_CHECKING, Literal, cast |
20 | 20 | from zipfile import ZIP_DEFLATED, ZIP_STORED |
21 | 21 |
|
22 | 22 | from packaging import tags, version as _packaging_version |
|
26 | 26 | from .._core_metadata import _safe_license_file |
27 | 27 | from .._normalization import safer_name |
28 | 28 | from ..warnings import SetuptoolsDeprecationWarning |
29 | | -from .egg_info import egg_info as egg_info_cls |
30 | 29 |
|
31 | 30 | from distutils import log |
32 | 31 |
|
| 32 | +if TYPE_CHECKING: |
| 33 | + from .egg_info import egg_info as egg_info_cls |
| 34 | + |
33 | 35 |
|
34 | 36 | def safe_version(version: str) -> str: |
35 | 37 | """ |
@@ -233,7 +235,9 @@ def finalize_options(self) -> None: |
233 | 235 | self.bdist_dir = os.path.join(bdist_base, "wheel") |
234 | 236 |
|
235 | 237 | if self.dist_info_dir is None: |
236 | | - egg_info = cast(egg_info_cls, self.distribution.get_command_obj("egg_info")) |
| 238 | + egg_info = cast( |
| 239 | + "egg_info_cls", self.distribution.get_command_obj("egg_info") |
| 240 | + ) |
237 | 241 | egg_info.ensure_finalized() # needed for correct `wheel_dist_name` |
238 | 242 |
|
239 | 243 | self.data_dir = self.wheel_dist_name + ".data" |
@@ -492,7 +496,7 @@ def license_paths(self) -> Iterable[str]: |
492 | 496 | metadata = self.distribution.get_option_dict("metadata") |
493 | 497 | if setuptools_major_version >= 42: |
494 | 498 | # Setuptools recognizes the license_files option but does not do globbing |
495 | | - patterns = cast(Sequence[str], self.distribution.metadata.license_files) |
| 499 | + patterns = cast("Sequence[str]", self.distribution.metadata.license_files) |
496 | 500 | else: |
497 | 501 | # Prior to those, wheel is entirely responsible for handling license files |
498 | 502 | if "license_files" in metadata: |
|
0 commit comments