0

[BE]: Use undocumented temp shim to restore setuptools compat ()

Pull Request resolved: https://github.com/pytorch/pytorch/pull/153052
Approved by: https://github.com/albanD
This commit is contained in:
Aaron Gokaslan
2025-05-12 18:33:37 +00:00
committed by PyTorch MergeBot
parent 3555ebb63d
commit fb85ebd710
3 changed files with 11 additions and 6 deletions

@ -25,8 +25,10 @@ Forum = "https://discuss.pytorch.org/"
[build-system]
requires = [
# After 75.8.2 dropped dep disttools API. Please fix
# API temporarily restored and shim used. Please fix
# Setuptools will drop support for setup.py past 80
# min version for recursive glob package data support
"setuptools>=62.3.0,<75.9",
"setuptools>=62.3.0,<80.0",
"wheel",
"astunparse",
"numpy",

@ -15,8 +15,8 @@ packaging
psutil
pyyaml
requests
# issue on Windows after >= 75.8.2 - https://github.com/pytorch/pytorch/issues/148877
setuptools>=62.3.0,<75.9
# setuptools develop deprecated on 80.0
setuptools>=62.3.0,<80.0
sympy>=1.13.3
types-dataclasses
typing-extensions>=4.10.0

@ -2533,9 +2533,12 @@ def _get_vc_env(vc_arch: str) -> dict[str, str]:
from setuptools import distutils
return distutils._msvccompiler._get_vc_env(vc_arch)
except AttributeError:
from setuptools._distutils import _msvccompiler
return _msvccompiler._get_vc_env(vc_arch)
try:
from setuptools._distutils import _msvccompiler
return _msvccompiler._get_vc_env(vc_arch)
except AttributeError:
from setuptools._distutils.compilers.C import msvc
return msvc._get_vc_env(vc_arch)
def _run_ninja_build(build_directory: str, verbose: bool, error_prefix: str) -> None:
command = ['ninja', '-v']