summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/news.rst15
-rw-r--r--src/wheel/__init__.py2
-rw-r--r--src/wheel/bdist_wheel.py5
-rw-r--r--src/wheel/macosx_libfile.py30
-rw-r--r--tests/test_macosx_libfile.py35
-rwxr-xr-xtests/testdata/macosx_minimal_system_version/test_lib_10_9_universal2.dylibbin0 -> 65936 bytes
-rw-r--r--tests/testdata/macosx_minimal_system_version/test_lib_11.dylibbin0 -> 16464 bytes
7 files changed, 75 insertions, 12 deletions
diff --git a/docs/news.rst b/docs/news.rst
index 12c1a78..1bf58bc 100644
--- a/docs/news.rst
+++ b/docs/news.rst
@@ -3,6 +3,18 @@ Release Notes
**UNRELEASED**
+- Fixed wrong platform tag on aarch64 running a 32-bit OS
+
+**0.36.1 (2020-12-04)**
+
+- Fixed ``AssertionError`` when ``MACOSX_DEPLOYMENT_TARGET`` was set to ``11``
+ (PR by Grzegorz Bokota and François-Xavier Coudert)
+- Fixed regression introduced in 0.36.0 on Python 2.7 when a custom generator
+ name was passed as unicode (Scikit-build)
+ (``TypeError: 'unicode' does not have the buffer interface``)
+
+**0.36.0 (2020-12-01)**
+
- Added official Python 3.9 support
- Updated vendored ``packaging`` library to v20.7
- Switched to always using LF as line separator when generating ``WHEEL`` files
@@ -11,7 +23,8 @@ Release Notes
is ``pypy37-pp73`` which is not compliant with PEP 3149, as it should have
both the API tag and the platform tag. This change future-proofs any change
in PyPy's SOABI tag to make sure only the ABI tag is used by wheel.
-- Fixed wrong platform tag on aarch64 running a 32-bit OS
+- Fixed regression and test for ``bdist_wheel --plat-name``. It was ignored for
+ C extensions in v0.35, but the regression was not detected by tests.
**0.35.1 (2020-08-14)**
diff --git a/src/wheel/__init__.py b/src/wheel/__init__.py
index 288ed76..eb426c5 100644
--- a/src/wheel/__init__.py
+++ b/src/wheel/__init__.py
@@ -1 +1 @@
-__version__ = '0.35.1'
+__version__ = '0.36.1'
diff --git a/src/wheel/bdist_wheel.py b/src/wheel/bdist_wheel.py
index a28b0b7..585d136 100644
--- a/src/wheel/bdist_wheel.py
+++ b/src/wheel/bdist_wheel.py
@@ -378,6 +378,11 @@ class bdist_wheel(Command):
def write_wheelfile(self, wheelfile_base, generator='bdist_wheel (' + wheel_version + ')'):
from email.message import Message
+
+ # Workaround for Python 2.7 for when "generator" is unicode
+ if sys.version_info < (3,) and not isinstance(generator, str):
+ generator = generator.encode('utf-8')
+
msg = Message()
msg['Wheel-Version'] = '1.0' # of the spec
msg['Generator'] = generator
diff --git a/src/wheel/macosx_libfile.py b/src/wheel/macosx_libfile.py
index 9141f26..8918039 100644
--- a/src/wheel/macosx_libfile.py
+++ b/src/wheel/macosx_libfile.py
@@ -33,6 +33,9 @@ Important remarks:
- All structures signatures are taken form macosx header files.
- I think that binary format will be more stable than `otool` output.
and if apple introduce some changes both implementation will need to be updated.
+- The system compile will set the deployment target no lower than
+ 11.0 for arm64 builds. For "Universal 2" builds use the x86_64 deployment
+ target when the arm64 target is 11.0.
"""
import ctypes
@@ -53,6 +56,7 @@ MH_CIGAM_64 = 0xcffaedfe
LC_VERSION_MIN_MACOSX = 0x24
LC_BUILD_VERSION = 0x32
+CPU_TYPE_ARM64 = 0x0100000c
mach_header_fields = [
("magic", ctypes.c_uint32), ("cputype", ctypes.c_int),
@@ -271,6 +275,16 @@ def extract_macosx_min_system_version(path_to_lib):
try:
version = read_mach_header(lib_file, el.offset)
if version is not None:
+ if el.cputype == CPU_TYPE_ARM64 and len(fat_arch_list) != 1:
+ # Xcode will not set the deployment target below 11.0.0
+ # for the arm64 architecture. Ignore the arm64 deployment
+ # in fat binaries when the target is 11.0.0, that way
+ # the other architetures can select a lower deployment
+ # target.
+ # This is safe because there is no arm64 variant for
+ # macOS 10.15 or earlier.
+ if version == (11, 0, 0):
+ continue
versions_list.append(version)
except ValueError:
pass
@@ -350,15 +364,16 @@ def calculate_macosx_platform_tag(archive_root, platform_tag):
"""
prefix, base_version, suffix = platform_tag.split('-')
base_version = tuple([int(x) for x in base_version.split(".")])
- if len(base_version) >= 2:
- base_version = base_version[0:2]
-
+ base_version = base_version[:2]
+ 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]
+ deploy_target = deploy_target[:2]
+ 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 "
@@ -378,7 +393,10 @@ def calculate_macosx_platform_tag(archive_root, platform_tag):
lib_path = os.path.join(dirpath, filename)
min_ver = extract_macosx_min_system_version(lib_path)
if min_ver is not None:
- versions_dict[lib_path] = min_ver[0:2]
+ min_ver = min_ver[0:2]
+ if min_ver[0] > 10:
+ min_ver = (min_ver[0], 0)
+ versions_dict[lib_path] = min_ver
if len(versions_dict) > 0:
base_version = max(base_version, max(versions_dict.values()))
diff --git a/tests/test_macosx_libfile.py b/tests/test_macosx_libfile.py
index 0424cb8..f108bde 100644
--- a/tests/test_macosx_libfile.py
+++ b/tests/test_macosx_libfile.py
@@ -20,7 +20,9 @@ def test_read_from_dylib():
("test_lib_10_10_386.dylib", "10.10.0"),
("test_lib_10_14_386.dylib", "10.14.0"),
("test_lib_multiple_fat.dylib", "10.14.0"),
- ("test_lib_10_10_10.dylib", "10.10.10")
+ ("test_lib_10_10_10.dylib", "10.10.10"),
+ ("test_lib_11.dylib", "11.0.0"),
+ ("test_lib_10_9_universal2.dylib", "10.9.0"),
]
for file_name, ver in versions:
extracted = extract_macosx_min_system_version(
@@ -47,14 +49,14 @@ class TestGetPlatformMacosx:
def test_simple(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.14-x86_64"))
- assert get_platform(dylib_dir) == "macosx_10_14_x86_64"
+ monkeypatch.setattr(distutils.util, "get_platform", return_factory("macosx-11.0-x86_64"))
+ assert get_platform(dylib_dir) == "macosx_11_0_x86_64"
def test_version_bump(self, monkeypatch, capsys):
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"))
- assert get_platform(dylib_dir) == "macosx_10_14_x86_64"
+ assert get_platform(dylib_dir) == "macosx_11_0_x86_64"
captured = capsys.readouterr()
assert "[WARNING] This wheel needs a higher macOS version than" in captured.err
@@ -125,3 +127,28 @@ class TestGetPlatformMacosx:
assert get_platform(dylib_dir) == "macosx_10_9_x86_64"
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"))
+ monkeypatch.setattr(sys, "maxsize", 2147483647)
+ assert get_platform(None) == "linux_i686"
diff --git a/tests/testdata/macosx_minimal_system_version/test_lib_10_9_universal2.dylib b/tests/testdata/macosx_minimal_system_version/test_lib_10_9_universal2.dylib
new file mode 100755
index 0000000..26ab109
--- /dev/null
+++ b/tests/testdata/macosx_minimal_system_version/test_lib_10_9_universal2.dylib
Binary files differ
diff --git a/tests/testdata/macosx_minimal_system_version/test_lib_11.dylib b/tests/testdata/macosx_minimal_system_version/test_lib_11.dylib
new file mode 100644
index 0000000..80202c1
--- /dev/null
+++ b/tests/testdata/macosx_minimal_system_version/test_lib_11.dylib
Binary files differ