Python: fix Apple Clang +optimizations build (#39412)

This commit is contained in:
Adam J. Stewart 2023-08-13 20:47:47 -05:00 committed by GitHub
parent abbd1abc1a
commit 151c551781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -308,7 +308,7 @@ class Python(Package):
conflicts("%nvhpc")
# https://bugs.python.org/issue45405
conflicts("@:3.7.2,3.8.0:3.8.12,3.9.0:3.9.10,3.10.0:3.10.2", when="%apple-clang@13:")
conflicts("@:3.7.12,3.8.0:3.8.12,3.9.0:3.9.7,3.10.0", when="%apple-clang@13:")
# See https://github.com/python/cpython/issues/106424
# datetime.now(timezone.utc) segfaults
@ -435,6 +435,11 @@ def setup_build_environment(self, env):
if spec.satisfies("%gcc") or spec.satisfies("%fj"):
env.unset("LC_ALL")
# https://github.com/python/cpython/issues/87275
if spec.satisfies("@:3.9.5 +optimizations %apple-clang"):
xcrun = Executable("/usr/bin/xcrun")
env.set("LLVM_AR", xcrun("-find", "ar", output=str).strip())
def flag_handler(self, name, flags):
# python 3.8 requires -fwrapv when compiled with intel
if self.spec.satisfies("@3.8: %intel"):