diff -ur misc/Python-3.11.15/setup.py misc/build/Python-3.11.15/setup.py --- misc/Python-3.11.15/setup.py 2025-01-01 00:00:00.000000000 +0000 +++ misc/build/Python-3.11.15/setup.py 2025-01-01 00:00:00.000000000 +0000 @@ -248,24 +248,24 @@ # system, but with only header files and libraries. sysroot = macosx_sdk_root() - # Check the standard locations - for dir_ in std_dirs: + # Check the additional directories (solver paths take priority) + for dir_ in paths: f = os.path.join(dir_, filename) if MACOS and is_macosx_sdk_path(dir_): f = os.path.join(sysroot, dir_[1:], filename) - if os.path.exists(f): return [] + if os.path.exists(f): + return [dir_] - # Check the additional directories - for dir_ in paths: + # Check the standard locations + for dir_ in std_dirs: f = os.path.join(dir_, filename) if MACOS and is_macosx_sdk_path(dir_): f = os.path.join(sysroot, dir_[1:], filename) - if os.path.exists(f): - return [dir_] + if os.path.exists(f): return [] # Not found anywhere return None