aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2023-08-29 12:41:46 +0200
committerShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2023-09-08 21:39:06 +0200
commit0d500d003d4c8f199aaae3cfa830227261b48ed0 (patch)
treeaf27924e8615ab61f74167f350c5b23b477d5f08
parent9bca4e6c1d2a1a374dee704c33e1b8f6ab337f61 (diff)
macOS wheel creation: Fix wheel name
- The macOS version in the wheel name was picked up from Python's build configuration instead of Qt. - The solution involves writing the cmake variable QT_DARWIN_MIN_DEPLOYMENT_TARGET into _config.py, and create_wheels.py loads this _config.py to fetch the python variable storing it. Pick-to: 6.5 Fixes: PYSIDE-2429 Change-Id: I85003174b83ba937c8b3e1498b728f13d960284e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--create_wheels.py14
-rw-r--r--sources/pyside6/PySide6/_config.py.in1
-rw-r--r--sources/shiboken6/cmake/ShibokenHelpers.cmake11
-rw-r--r--sources/shiboken6/generator/_config.py.in1
-rw-r--r--sources/shiboken6/shibokenmodule/_config.py.in1
5 files changed, 27 insertions, 1 deletions
diff --git a/create_wheels.py b/create_wheels.py
index ad52aa9c5..e3c9d1d85 100644
--- a/create_wheels.py
+++ b/create_wheels.py
@@ -4,6 +4,7 @@
import os
import platform
import sys
+import importlib
from argparse import ArgumentParser, Namespace
from dataclasses import dataclass
from pathlib import Path
@@ -86,7 +87,18 @@ def generate_setup_cfg(artifacts: Path, setup: SetupData) -> str:
# Will generate manylinux_2_28_x86_64
_tag = f"manylinux_{glibc}_{arch}"
elif _os == "darwin":
- target = get_config_var("MACOSX_DEPLOYMENT_TARGET")
+ # find _config.py and load it to obtain __qt_macos_min_deployment_target__
+ target = None
+ config_py = package_path / "shiboken6" / "_config.py"
+ if not config_py.exists():
+ raise RuntimeError(f"Unable to find {str(config_py)}")
+
+ module_name = config_py.name[:-3]
+ _spec = importlib.util.spec_from_file_location(f"{module_name}", config_py)
+ _module = importlib.util.module_from_spec(_spec)
+ _spec.loader.exec_module(module=_module)
+ target = _module.__qt_macos_min_deployment_target__
+
if not target:
print("Error: couldn't get the value from MACOSX_DEPLOYMENT_TARGET. "
"Falling back to local platform version.")
diff --git a/sources/pyside6/PySide6/_config.py.in b/sources/pyside6/PySide6/_config.py.in
index 740e9a001..27ee0789b 100644
--- a/sources/pyside6/PySide6/_config.py.in
+++ b/sources/pyside6/PySide6/_config.py.in
@@ -14,3 +14,4 @@ version_info = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDI
@PACKAGE_BUILD_COMMIT_HASH_DESCRIBED@
@PACKAGE_SETUP_PY_PACKAGE_TIMESTAMP_ASSIGNMENT@
@PACKAGE_SETUP_PY_PACKAGE_VERSION_ASSIGNMENT@
+@QT_MACOS_DEPLOYMENT_TARGET@
diff --git a/sources/shiboken6/cmake/ShibokenHelpers.cmake b/sources/shiboken6/cmake/ShibokenHelpers.cmake
index ff7f0ffa2..4fdfe3648 100644
--- a/sources/shiboken6/cmake/ShibokenHelpers.cmake
+++ b/sources/shiboken6/cmake/ShibokenHelpers.cmake
@@ -598,6 +598,17 @@ endfunction()
macro(compute_config_py_values
full_version_var_name
)
+ set(QT_MACOS_DEPLOYMENT_TARGET "")
+ if (Qt${QT_MAJOR_VERSION}Core_FOUND)
+ get_target_property(darwin_target Qt6::Core QT_DARWIN_MIN_DEPLOYMENT_TARGET)
+ if(darwin_target)
+ set(QT_MACOS_DEPLOYMENT_TARGET
+ "__qt_macos_min_deployment_target__ = '${darwin_target}'")
+ endif()
+ elseif(APPLE)
+ message(FATAL_ERROR "Qt6::Core should be found before calling this macro")
+ endif()
+
string(TIMESTAMP PACKAGE_BUILD_DATE "%Y-%m-%dT%H:%M:%S+00:00" UTC)
if (PACKAGE_BUILD_DATE)
set(PACKAGE_BUILD_DATE "__build_date__ = '${PACKAGE_BUILD_DATE}'")
diff --git a/sources/shiboken6/generator/_config.py.in b/sources/shiboken6/generator/_config.py.in
index 985735fa4..ed7e67098 100644
--- a/sources/shiboken6/generator/_config.py.in
+++ b/sources/shiboken6/generator/_config.py.in
@@ -7,3 +7,4 @@ version_info = (@shiboken_MAJOR_VERSION@, @shiboken_MINOR_VERSION@, @shiboken_MI
@PACKAGE_BUILD_COMMIT_HASH_DESCRIBED@
@PACKAGE_SETUP_PY_PACKAGE_TIMESTAMP_ASSIGNMENT@
@PACKAGE_SETUP_PY_PACKAGE_VERSION_ASSIGNMENT@
+@QT_MACOS_DEPLOYMENT_TARGET@
diff --git a/sources/shiboken6/shibokenmodule/_config.py.in b/sources/shiboken6/shibokenmodule/_config.py.in
index 92b3cd23c..600c431c9 100644
--- a/sources/shiboken6/shibokenmodule/_config.py.in
+++ b/sources/shiboken6/shibokenmodule/_config.py.in
@@ -9,3 +9,4 @@ version_info = (@shiboken_MAJOR_VERSION@, @shiboken_MINOR_VERSION@, @shiboken_MI
@PACKAGE_BUILD_COMMIT_HASH_DESCRIBED@
@PACKAGE_SETUP_PY_PACKAGE_TIMESTAMP_ASSIGNMENT@
@PACKAGE_SETUP_PY_PACKAGE_VERSION_ASSIGNMENT@
+@QT_MACOS_DEPLOYMENT_TARGET@