[Feature Request] Public interface for _msvccompiler._get_vc_env
pytorch's repository is using an import of setuptools / distutil.
https://github.com/pytorch/pytorch/blob/main/tools/build_pytorch_libs.py#L17-L25
def _get_vc_env(vc_arch: str) -> dict[str, str]:
try:
from setuptools import distutils # type: ignore[import]
return distutils._msvccompiler._get_vc_env(vc_arch) # type: ignore[no-any-return]
except AttributeError:
from setuptools._distutils import _msvccompiler # type: ignore[import]
return _msvccompiler._get_vc_env(vc_arch) # type: ignore[no-any-return]
However, its location/implementation is being changed and causing the errors as follows:
AttributeError: module 'distutils._msvccompiler' has no attribute '_get_vc_env'
Example issues: https://github.com/pypa/setuptools/issues/4874 https://github.com/pytorch/pytorch/issues/148877 https://github.com/pytorch/pytorch/issues/141319
Could you please open a reliable public interface for _get_vc_env , so pytorch 's repository could be updated to use that import for the future versions?
Can you tell me more about the use-case(s) for this function? Does the setuptools.msvc module provide the necessary behaviors? Is _get_vc_env used to extract the inner details of the compiler or is it used simply to pass through to invocations of build tools?
Based on use case which I've provided in the description for the PyTorch:
It is being used to get necessary environment variables of MSVC as dictionary and it is being passed to cmake for further process.
As far as I see, setuptools.msvc module doesn't have a function to return environment variables as dictionary as _msvccompiler._get_vc_env(vc_arch) does.