Remove -arch flags from LDSHARED flags from distutils on macOS

This is causing libraries to always be linked with arm64 & x86_64 flags
when Python has been built as universal, which is the case with recent
official Pythons.
This commit is contained in:
Scott Talbert
2025-02-26 20:25:10 -05:00
parent 1766336e55
commit ba92977486

View File

@@ -280,6 +280,14 @@ class Configuration(object):
del LDSHARED[index:index+2]
except ValueError:
break
# also remove any -arch flags and their arg
while True:
try:
index = LDSHARED.index('-arch')
# Strip this argument and the next one:
del LDSHARED[index:index+2]
except ValueError:
break
LDSHARED = ' '.join(LDSHARED)
# Combine with wx's ld command and stash it in the env
# where distutils will get it later.