[BE][Easy] do not install yanked types-pkg-resources in lint environment (#156462)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/156462
Approved by: https://github.com/ezyang
This commit is contained in:
Xuehai Pan
2025-06-20 15:59:48 +08:00
committed by PyTorch MergeBot
parent 1036f6d114
commit 63360e64da
5 changed files with 15 additions and 13 deletions

View File

@ -157,18 +157,18 @@ init_command = [
'mypy==1.16.0',
'sympy==1.13.3',
'types-requests==2.27.25',
'types-PyYAML==6.0.7',
'types-pyyaml==6.0.1',
'types-tabulate==0.8.8',
'types-protobuf==5.29.1.20250403',
'types-pkg-resources==0.1.3',
'types-Jinja2==2.11.9',
'types-setuptools==79.0.0.20250422',
'types-jinja2==2.11.9',
'types-colorama==0.4.6',
'filelock==3.13.1',
'junitparser==2.1.1',
'rich==10.9.0',
'pyyaml==6.0.1',
'optree==0.13.0',
'dataclasses_json==0.6.7',
'dataclasses-json==0.6.7',
'pandas==2.2.3',
]

View File

@ -11,7 +11,7 @@ from difflib import SequenceMatcher
from typing import Any
import requests
from setuptools import distutils # type: ignore[import]
from setuptools import distutils # type: ignore[import,attr-defined]
ALL_SKIPPED_THRESHOLD = 100

View File

@ -15,13 +15,15 @@ from .setup_helpers.env import (
def _get_vc_env(vc_arch: str) -> dict[str, str]:
try:
from setuptools import distutils # type: ignore[import]
from setuptools import distutils # type: ignore[import,attr-defined]
return distutils._msvccompiler._get_vc_env(vc_arch) # type: ignore[no-any-return]
except AttributeError:
from setuptools._distutils import _msvccompiler # type: ignore[import]
from setuptools._distutils import (
_msvccompiler, # type: ignore[import,attr-defined]
)
return _msvccompiler._get_vc_env(vc_arch) # type: ignore[no-any-return]
return _msvccompiler._get_vc_env(vc_arch) # type: ignore[no-any-return,attr-defined]
def _overlay_windows_vcvars(env: dict[str, str]) -> dict[str, str]:

View File

@ -6,7 +6,7 @@ import re
import subprocess
from pathlib import Path
from setuptools import distutils # type: ignore[import]
from setuptools import distutils # type: ignore[import,attr-defined]
UNKNOWN = "Unknown"

View File

@ -2548,15 +2548,15 @@ def _get_num_workers(verbose: bool) -> Optional[int]:
def _get_vc_env(vc_arch: str) -> dict[str, str]:
try:
from setuptools import distutils
from setuptools import distutils # type: ignore[attr-defined]
return distutils._msvccompiler._get_vc_env(vc_arch)
except AttributeError:
try:
from setuptools._distutils import _msvccompiler
return _msvccompiler._get_vc_env(vc_arch)
return _msvccompiler._get_vc_env(vc_arch) # type: ignore[attr-defined]
except AttributeError:
from setuptools._distutils.compilers.C import msvc
return msvc._get_vc_env(vc_arch)
return msvc._get_vc_env(vc_arch) # type: ignore[attr-defined]
def _run_ninja_build(build_directory: str, verbose: bool, error_prefix: str) -> None:
command = ['ninja', '-v']
@ -2566,7 +2566,7 @@ def _run_ninja_build(build_directory: str, verbose: bool, error_prefix: str) ->
env = os.environ.copy()
# Try to activate the vc env for the users
if IS_WINDOWS and 'VSCMD_ARG_TGT_ARCH' not in env:
from setuptools import distutils
from setuptools import distutils # type: ignore[attr-defined]
plat_name = distutils.util.get_platform()
plat_spec = PLAT_TO_VCVARS[plat_name]