Skip to content

Commit 44f82f5

Browse files
committed
fix: Ensure expected platform tag is associated with Linux wheels
This improves the handling of platform tags for Linux wheels by setting the correct platform tag based on the VTK SDK archive name. This ensures the wheels are correctly tagged and can be identified properly during distribution.
1 parent 3d44bdd commit 44f82f5

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ jobs:
108108
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
109109
CIBW_ARCHS: "${{ matrix.arch }}"
110110
CIBW_REPAIR_WHEEL_COMMAND: ""
111+
# Workaround to allow mapping current wheel tag with the one extracted from
112+
# the vtk-sdk archive name
113+
VTK_SDK_WHEEL_OUTPUT_DIR: "/host/wheelhouse"
114+
CIBW_ENVIRONMENT_PASS_LINUX: "VTK_SDK_WHEEL_OUTPUT_DIR"
115+
CIBW_REPAIR_WHEEL_COMMAND_LINUX:
116+
'mv {wheel} {dest_dir}/ && uvx wheel tags --remove --platform-tag
117+
"$(cat "$VTK_SDK_WHEEL_OUTPUT_DIR/$(basename {wheel}-tag)")"
118+
"{dest_dir}/$(basename {wheel})"'
111119

112120
- name: Upload wheels
113121
uses: actions/upload-artifact@v4

cmake/vtk-sdk-urls.cmake

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ message(STATUS " python_tag: ${python_tag}")
1515
message(STATUS " abi_tag: ${abi_tag}")
1616

1717
# Platform tag
18-
if(LINUX)
18+
if(UNIX AND NOT APPLE)
1919
if(Python_SOABI MATCHES "x86_64")
2020
set(platform_tag "manylinux2014_x86_64.manylinux_2_17_x86_64")
2121
elseif(Python_SOABI MATCHES "aarch64")
@@ -122,3 +122,33 @@ endif()
122122
set(VTK_SDK_EXPECTED_SHA256
123123
${sha256_${VTK_VERSION}-${python_tag}-${abi_tag}-${platform_tag}})
124124
message(STATUS "Setting VTK_SDK_EXPECTED_SHA256: ${VTK_SDK_EXPECTED_SHA256}")
125+
126+
# ----------------------------------------------------------------------------
127+
# On Linux (manylinux), compute the pre-repair platform tag and write the
128+
# expected final platform tag (derived from the VTK SDK archive) to a file that
129+
# the wheel repair step will read.
130+
if(UNIX AND NOT APPLE)
131+
# Determine the platform tag as produced by the current build environment
132+
execute_process(
133+
COMMAND
134+
"${Python3_EXECUTABLE}" -c
135+
"import sysconfig; print(sysconfig.get_platform().replace('-', '_'))"
136+
OUTPUT_VARIABLE pre_repair_platform_tag
137+
OUTPUT_STRIP_TRAILING_WHITESPACE)
138+
139+
message(STATUS "Pre-repair platform tag: ${pre_repair_platform_tag}")
140+
141+
# Map current wheel tag to the one from the VTK SDK archive name
142+
set(wheel_output_dir "$ENV{VTK_SDK_WHEEL_OUTPUT_DIR}")
143+
if(NOT "${wheel_output_dir}" STREQUAL "")
144+
message(STATUS "VTK_SDK_WHEEL_OUTPUT_DIR: ${wheel_output_dir}")
145+
file(MAKE_DIRECTORY "${wheel_output_dir}")
146+
set(wheel_tag_file
147+
"vtk_sdk-${_norm_tag}-${python_tag}-${abi_tag}-${pre_repair_platform_tag}.whl-tag"
148+
)
149+
file(WRITE "${wheel_output_dir}/${wheel_tag_file}" "${platform_tag}")
150+
message(
151+
STATUS
152+
"Wrote expected platform tag '${platform_tag}' to: ${wheel_tag_file}")
153+
endif()
154+
endif()

0 commit comments

Comments
 (0)