Skip to content

Commit a36b7ba

Browse files
authored
Merge pull request #4786 from swt2c/fix_msvc_host_dir_arm64
setuptools.msvc: set host_dir correctly on ARM64 hosts
2 parents 84b7b2a + 5b66977 commit a36b7ba

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Diff for: newsfragments/4786.feature.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
In setuptools.msvc.EnvironmentInfo, now honor the correct paths when on an ARM host.

Diff for: setuptools/msvc.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,16 @@ def VCTools(self):
10241024
------
10251025
list of str
10261026
paths
1027+
1028+
When host CPU is ARM, the tools should be found for ARM.
1029+
1030+
>>> getfixture('windows_only')
1031+
>>> mp = getfixture('monkeypatch')
1032+
>>> mp.setattr(PlatformInfo, 'current_cpu', 'arm64')
1033+
>>> ei = EnvironmentInfo(arch='irrelevant')
1034+
>>> paths = ei.VCTools
1035+
>>> any('HostARM64' in path for path in paths)
1036+
True
10271037
"""
10281038
si = self.si
10291039
tools = [os.path.join(si.VCInstallDir, 'VCPackages')]
@@ -1038,9 +1048,8 @@ def VCTools(self):
10381048
tools += [os.path.join(si.VCInstallDir, path)]
10391049

10401050
elif self.vs_ver >= 15.0:
1041-
host_dir = (
1042-
r'bin\HostX86%s' if self.pi.current_is_x86() else r'bin\HostX64%s'
1043-
)
1051+
host_id = self.pi.current_cpu.replace('amd64', 'x64').upper()
1052+
host_dir = os.path.join('bin', f'Host{host_id}%s')
10441053
tools += [
10451054
os.path.join(si.VCInstallDir, host_dir % self.pi.target_dir(x64=True))
10461055
]

0 commit comments

Comments
 (0)