Skip to content

Commit 1390742

Browse files
committed
COMP: Remove the ITK_USE_PYTHON_LIMITED_API option
Python wrapping requires 3.11, which is also the abi3 floor, so the option could only ever be on. Every wrapped module is now built as an abi3 extension and the CMake >= 3.26 requirement applies whenever ITK_WRAP_PYTHON is enabled.
1 parent e35c836 commit 1390742

1 file changed

Lines changed: 12 additions & 58 deletions

File tree

CMake/ITKSetPython3Vars.cmake

Lines changed: 12 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ else()
9494
)
9595
endif()
9696

97-
# start section to define package components based on LIMITED_API support and choices
9897
# Cached so the abi3 floor is a single source of truth shared with the module
9998
# wrapping macros (itk_end_wrap_module.cmake USE_SABI).
10099
set(
@@ -104,65 +103,21 @@ else()
104103
"Minimum Python minor version for the abi3 / Limited API floor"
105104
)
106105

107-
# Force ITK_WRAP_PYTHON_VERSION if SKBUILD_SABI_COMPONENT requests it
108-
string(
109-
FIND
110-
"${SKBUILD_SABI_COMPONENT}"
111-
"SABIModule"
112-
_SKBUILD_SABI_COMPONENT_REQUIRED
113-
)
114-
if(NOT DEFINED ITK_USE_PYTHON_LIMITED_API)
115-
if(
116-
(
117-
_SKBUILD_SABI_COMPONENT_REQUIRED
118-
GREATER
119-
-1
120-
)
121-
OR
122-
ITK_WRAP_PYTHON_VERSION
123-
VERSION_GREATER_EQUAL
124-
${_ITK_MINIMUM_SUPPORTED_LIMITED_API_VERSION}
106+
if(CMAKE_VERSION VERSION_LESS "3.26")
107+
message(
108+
FATAL_ERROR
109+
"CMake version ${CMAKE_VERSION} is too old for Python wrapping: "
110+
"the FindPython Development.SABIModule component requires CMake >= 3.26. "
111+
"Either upgrade CMake or set ITK_WRAP_PYTHON=OFF."
125112
)
126-
set(
127-
ITK_USE_PYTHON_LIMITED_API
128-
1
129-
CACHE BOOL
130-
"Configure Python's limited API for Python minor version compatibility."
131-
)
132-
else()
133-
set(
134-
ITK_USE_PYTHON_LIMITED_API
135-
0
136-
CACHE BOOL
137-
"Configure Python's limited API for Python minor version compatibility."
138-
)
139-
endif()
140-
mark_as_advanced(ITK_USE_PYTHON_LIMITED_API)
141113
endif()
142-
unset(_SKBUILD_SABI_COMPONENT_REQUIRED)
143-
if(ITK_USE_PYTHON_LIMITED_API)
144-
if(CMAKE_VERSION VERSION_LESS "3.26")
145-
message(
146-
FATAL_ERROR
147-
"CMake version ${CMAKE_VERSION} is too old for Python limited API wrapping: "
148-
"the FindPython Development.SABIModule component requires CMake >= 3.26. "
149-
"Either upgrade CMake or disable ITK_USE_PYTHON_LIMITED_API."
150-
)
151-
endif()
152114

153-
set(
154-
_python_find_components
155-
Interpreter
156-
Development.Module
157-
Development.SABIModule
158-
)
159-
else()
160-
set(
161-
_python_find_components
162-
Interpreter
163-
Development.Module
164-
)
165-
endif()
115+
set(
116+
_python_find_components
117+
Interpreter
118+
Development.Module
119+
Development.SABIModule
120+
)
166121
if(BUILD_TESTING)
167122
# NumPy Required for testing ITK PythonTests, prefer to fail early if not installed
168123
list(APPEND _python_find_components NumPy)
@@ -253,7 +208,6 @@ else()
253208
unset(_python_find_components)
254209
# _ITK_MINIMUM_SUPPORTED_LIMITED_API_VERSION is cached (INTERNAL) and intentionally
255210
# left set so itk_end_wrap_module.cmake can pin USE_SABI to the same floor.
256-
# end section to define package components based on LIMITED_API support and choices
257211
if(DEFINED _specified_Python3_EXECUTABLE)
258212
set(
259213
Python3_EXECUTABLE

0 commit comments

Comments
 (0)