bpo-41100: Support macOS 11 and Apple Silicon (GH-22855)

Co-authored-by:  Lawrence D’Anna <lawrence_danna@apple.com>

* Add support for macOS 11 and Apple Silicon (aka arm64)
   
  As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy

* Support building on recent versions of macOS while deploying to older versions

  This allows building installers on macOS 11 while still supporting macOS 10.9.
This commit is contained in:
Ronald Oussoren 2020-11-08 10:05:27 +01:00 committed by GitHub
parent fd6f6fa403
commit 41761933c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 1654 additions and 412 deletions

View file

@ -1041,6 +1041,36 @@ class TestOldPyTime(CPyTimeTestCase, unittest.TestCase):
with self.assertRaises(ValueError):
pytime_object_to_timespec(float('nan'), time_rnd)
@unittest.skipUnless(sys.platform == "darwin", "test weak linking on macOS")
class TestTimeWeaklinking(unittest.TestCase):
# These test cases verify that weak linking support on macOS works
# as expected. These cases only test new behaviour introduced by weak linking,
# regular behaviour is tested by the normal test cases.
#
# See the section on Weak Linking in Mac/README.txt for more information.
def test_clock_functions(self):
import sysconfig
import platform
config_vars = sysconfig.get_config_vars()
var_name = "HAVE_CLOCK_GETTIME"
if var_name not in config_vars or not config_vars[var_name]:
raise unittest.SkipTest(f"{var_name} is not available")
mac_ver = tuple(int(x) for x in platform.mac_ver()[0].split("."))
clock_names = [
"CLOCK_MONOTONIC", "clock_gettime", "clock_gettime_ns", "clock_settime",
"clock_settime_ns", "clock_getres"]
if mac_ver >= (10, 12):
for name in clock_names:
self.assertTrue(hasattr(time, name), f"time.{name} is not available")
else:
for name in clock_names:
self.assertFalse(hasattr(time, name), f"time.{name} is available")
if __name__ == "__main__":
unittest.main()