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

Fix for bigsur #386

Merged
merged 4 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/wheel/macosx_libfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,16 @@ def calculate_macosx_platform_tag(archive_root, platform_tag):
base_version = tuple([int(x) for x in base_version.split(".")])
if len(base_version) >= 2:
base_version = base_version[0:2]
Czaki marked this conversation as resolved.
Show resolved Hide resolved

if base_version[0] > 10:
base_version = (base_version[0], 0)
assert len(base_version) == 2
if "MACOSX_DEPLOYMENT_TARGET" in os.environ:
deploy_target = tuple([int(x) for x in os.environ[
"MACOSX_DEPLOYMENT_TARGET"].split(".")])
if len(deploy_target) >= 2:
deploy_target = deploy_target[0:2]
Czaki marked this conversation as resolved.
Show resolved Hide resolved
if deploy_target[0] > 10:
deploy_target = (deploy_target[0], 0)
if deploy_target < base_version:
sys.stderr.write(
"[WARNING] MACOSX_DEPLOYMENT_TARGET is set to a lower value ({}) than the "
Expand Down
19 changes: 19 additions & 0 deletions tests/test_macosx_libfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,25 @@ def test_warning_on_to_low_env_variable(self, monkeypatch, capsys):
captured = capsys.readouterr()
assert "MACOSX_DEPLOYMENT_TARGET is set to a lower value (10.8) than the" in captured.err

def test_get_platform_bigsur_env(self, monkeypatch):
dirname = os.path.dirname(__file__)
dylib_dir = os.path.join(dirname, "testdata", "macosx_minimal_system_version")
monkeypatch.setattr(distutils.util, "get_platform", return_factory("macosx-10.9-x86_64"))
monkeypatch.setenv("MACOSX_DEPLOYMENT_TARGET", "11")
monkeypatch.setattr(os, "walk", return_factory(
[(dylib_dir, [], ["test_lib_10_6.dylib", "test_lib_10_10_fat.dylib"])]
))
assert get_platform(dylib_dir) == "macosx_11_0_x86_64"

def test_get_platform_bigsur_platform(self, monkeypatch):
dirname = os.path.dirname(__file__)
dylib_dir = os.path.join(dirname, "testdata", "macosx_minimal_system_version")
monkeypatch.setattr(distutils.util, "get_platform", return_factory("macosx-11-x86_64"))
monkeypatch.setattr(os, "walk", return_factory(
[(dylib_dir, [], ["test_lib_10_6.dylib", "test_lib_10_10_fat.dylib"])]
))
assert get_platform(dylib_dir) == "macosx_11_0_x86_64"


def test_get_platform_linux(monkeypatch):
monkeypatch.setattr(distutils.util, "get_platform", return_factory("linux_x86_64"))
Expand Down