From 809a9a7cf528037717e99d0a6c8cbc41f1b7b6a6 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 14 Sep 2024 19:39:30 -0400 Subject: [PATCH] Fix cross-platform compilation using `distutils._msvccompiler.MSVCCompiler`. Actually use the `plat_name` param in `MSVCCompiler.initialize`. Selective cherry-pick of pypa/distutils@a0339c1. Closes pypa/setuptools#4648. --- newsfragments/4648.bugfix.rst | 1 + setuptools/_distutils/_msvccompiler.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 newsfragments/4648.bugfix.rst diff --git a/newsfragments/4648.bugfix.rst b/newsfragments/4648.bugfix.rst new file mode 100644 index 0000000000..feb8edcc18 --- /dev/null +++ b/newsfragments/4648.bugfix.rst @@ -0,0 +1 @@ +Fix cross-platform compilation using ``distutils._msvccompiler.MSVCCompiler`` -- by :user:`saschanaz` and :user:`Avasam` \ No newline at end of file diff --git a/setuptools/_distutils/_msvccompiler.py b/setuptools/_distutils/_msvccompiler.py index 03653929a8..bf10ae2365 100644 --- a/setuptools/_distutils/_msvccompiler.py +++ b/setuptools/_distutils/_msvccompiler.py @@ -284,7 +284,7 @@ def initialize(self, plat_name=None): f"--plat-name must be one of {tuple(_vcvars_names)}" ) - plat_spec = _get_vcvars_spec(get_host_platform(), get_platform()) + plat_spec = _get_vcvars_spec(get_host_platform(), plat_name) vc_env = _get_vc_env(plat_spec) if not vc_env: