Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for macos 11.0, arm64, universal2 #319

Merged
merged 11 commits into from
Nov 24, 2020
19 changes: 17 additions & 2 deletions packaging/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def _mac_binary_formats(version, cpu_arch):
if cpu_arch == "x86_64":
if version < (10, 4):
return []
formats.extend(["intel", "fat64", "fat32"])
formats.extend(["intel", "fat64", "fat32", "universal2"])

elif cpu_arch == "i386":
if version < (10, 4):
Expand All @@ -407,7 +407,12 @@ def _mac_binary_formats(version, cpu_arch):
return []
formats.extend(["fat32", "fat"])

formats.append("universal")
elif cpu_arch == "arm64":
formats.append("universal2")

if cpu_arch in {"x86_64", "i386", "ppc64", "ppc"}:
pradyunsg marked this conversation as resolved.
Show resolved Hide resolved
formats.append("universal")
lawrence-danna-apple marked this conversation as resolved.
Show resolved Hide resolved

return formats


Expand Down Expand Up @@ -439,6 +444,16 @@ def mac_platforms(version=None, arch=None):
minor=compat_version[1],
binary_format=binary_format,
)
if version >= (11, 0) and arch == "x86_64":
for minor_version in range(15, 3, -1):
compat_version = 10, minor_version
binary_formats = _mac_binary_formats(compat_version, arch)
for binary_format in binary_formats:
yield "macosx_{major}_{minor}_{binary_format}".format(
major=compat_version[0],
minor=compat_version[1],
binary_format=binary_format,
)


# From PEP 513, PEP 600
Expand Down
35 changes: 31 additions & 4 deletions tests/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,16 @@ def test_architectures(self, arch, is_32bit, expected):
@pytest.mark.parametrize(
"version,arch,expected",
[
((10, 17), "x86_64", ["x86_64", "intel", "fat64", "fat32", "universal"]),
((10, 4), "x86_64", ["x86_64", "intel", "fat64", "fat32", "universal"]),
(
(10, 17),
lawrence-danna-apple marked this conversation as resolved.
Show resolved Hide resolved
"x86_64",
["x86_64", "intel", "fat64", "fat32", "universal2", "universal"],
),
(
(10, 4),
"x86_64",
["x86_64", "intel", "fat64", "fat32", "universal2", "universal"],
),
((10, 3), "x86_64", []),
((10, 17), "i386", ["i386", "intel", "fat32", "fat", "universal"]),
((10, 4), "i386", ["i386", "intel", "fat32", "fat", "universal"]),
Expand All @@ -239,7 +247,13 @@ def test_architectures(self, arch, is_32bit, expected):
((10, 7), "ppc", []),
((10, 6), "ppc", ["ppc", "fat32", "fat", "universal"]),
((10, 0), "ppc", ["ppc", "fat32", "fat", "universal"]),
((11, 0), "riscv", ["riscv", "universal"]),
((11, 0), "riscv", ["riscv"]),
(
(11, 0),
"x86_64",
["x86_64", "intel", "fat64", "fat32", "universal2", "universal"],
),
((11, 0), "arm64", ["arm64", "universal2"]),
lawrence-danna-apple marked this conversation as resolved.
Show resolved Hide resolved
],
)
def test_binary_formats(self, version, arch, expected):
Expand Down Expand Up @@ -271,18 +285,31 @@ def test_mac_platforms(self):
"macosx_10_5_intel",
"macosx_10_5_fat64",
"macosx_10_5_fat32",
"macosx_10_5_universal2",
"macosx_10_5_universal",
"macosx_10_4_x86_64",
"macosx_10_4_intel",
"macosx_10_4_fat64",
"macosx_10_4_fat32",
"macosx_10_4_universal2",
"macosx_10_4_universal",
]

assert len(list(tags.mac_platforms((10, 17), "x86_64"))) == 14 * 5
assert len(list(tags.mac_platforms((10, 17), "x86_64"))) == 14 * 6

assert not list(tags.mac_platforms((10, 0), "x86_64"))

def test_macos_11(self):
platforms = list(tags.mac_platforms((11, 0), "x86_64"))
assert "macosx_10_15_x86_64" in platforms
assert "macosx_10_4_x86_64" in platforms
assert "macosx_10_3_x86_64" not in platforms

platforms = list(tags.mac_platforms((11, 0), "arm64"))
assert "macosx_10_15_x86_64" not in platforms
assert "macosx_10_4_x86_64" not in platforms
assert "macosx_10_3_x86_64" not in platforms
brettcannon marked this conversation as resolved.
Show resolved Hide resolved


class TestManylinuxPlatform:
def teardown_method(self):
Expand Down