Skip to content

Commit a7d75b0

Browse files
committed
ENH: linux amd64 scikit-build-core support
The requirements-dev.txt file was missing from the tarball, which was an existing bug.
1 parent 583af7b commit a7d75b0

File tree

2 files changed

+50
-18
lines changed

2 files changed

+50
-18
lines changed

scripts/dockcross-manylinux-build-tarball.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ fi
4141
tar -c --to-stdout \
4242
ITKPythonPackage/ITK-* \
4343
ITKPythonPackage/oneTBB* \
44+
ITKPythonPackage/requirements-dev.txt \
4445
ITKPythonPackage/scripts > ITKPythonBuilds-linux.tar
4546
$zstd_exe -f \
4647
-10 \

scripts/internal/manylinux-build-module-wheels.sh

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ usage()
3434
echo "Usage:
3535
manylinux-build-module-wheels
3636
[ -h | --help ] show usage
37-
[ -c | --cmake_options ] space-separated string of CMake options to forward to the module (e.g. \"-DBUILD_TESTING=OFF\")
37+
[ -c | --cmake_options ] space-separated string of CMake options to forward to the module (e.g. \"--config-setting=cmake.define.BUILD_TESTING=OFF\")
3838
[ -x | --exclude_libs ] semicolon-separated library names to exclude when repairing wheel (e.g. \"libcuda.so\")
3939
[ python_version ] build wheel for a specific python version. (e.g. cp39)"
4040
exit 2
@@ -73,8 +73,11 @@ source "${script_dir}/manylinux-build-common.sh"
7373
sudo ldconfig
7474
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/work/oneTBB-prefix/lib:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
7575

76-
# Swig pre-built version from ITK build in ITKPythonPackage
77-
SWIG_VERSION=4.0.2
76+
if test -e setup.py; then
77+
use_skbuild_classic=true
78+
else
79+
use_skbuild_classic=false
80+
fi
7881

7982
# Compile wheels re-using standalone project and archive cache
8083
for PYBIN in "${PYBINARIES[@]}"; do
@@ -85,6 +88,11 @@ for PYBIN in "${PYBINARIES[@]}"; do
8588
echo "Python3_EXECUTABLE:${Python3_EXECUTABLE}"
8689
echo "Python3_INCLUDE_DIR:${Python3_INCLUDE_DIR}"
8790

91+
if $use_skbuild_classic; then
92+
# So older remote modules with setup.py continue to work
93+
${Python3_EXECUTABLE} -m pip install --upgrade scikit-build
94+
fi
95+
8896
if [[ -e /work/requirements-dev.txt ]]; then
8997
${PYBIN}/pip install --upgrade -r /work/requirements-dev.txt
9098
elif [[ -e /ITKPythonPackage/requirements-dev.txt ]]; then
@@ -105,21 +113,42 @@ for PYBIN in "${PYBINARIES[@]}"; do
105113
echo 'ITK source tree not available!' 1>&2
106114
exit 1
107115
fi
108-
swig_args=""
109-
if [[ "${ARCH}" = "x64" ]]; then
110-
swig_args="-DITK_USE_SYSTEM_SWIG:BOOL=ON -DSWIG_VERSION:STRING=${SWIG_VERSION} -DSWIG_EXECUTABLE:FILEPATH=${itk_build_dir}/Wrapping/Generators/SwigInterface/swiglinux-${SWIG_VERSION}/bin/swig -DSWIG_DIR:FILEPATH=${itk_build_dir}/Wrapping/Generators/SwigInterface/swiglinux-${SWIG_VERSION}/share/swig/${SWIG_VERSION}"
116+
if $use_skbuild_classic; then
117+
${PYBIN}/python setup.py clean
118+
${PYBIN}/python setup.py bdist_wheel --build-type Release -G Ninja -- \
119+
-DITK_DIR:PATH=${itk_build_dir} \
120+
-DWRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING=PythonWheel \
121+
-DCMAKE_CXX_COMPILER_TARGET:STRING=$(uname -m)-linux-gnu \
122+
-DCMAKE_INSTALL_LIBDIR:STRING=lib \
123+
-DBUILD_TESTING:BOOL=OFF \
124+
-DPython3_EXECUTABLE:FILEPATH=${Python3_EXECUTABLE} \
125+
-DPython3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} \
126+
${CMAKE_OPTIONS} \
127+
|| exit 1
128+
else
129+
py_minor=$(echo $version | cut -d '-' -f 1 | cut -d '3' -f 2)
130+
wheel_py_api=""
131+
if test $py_minor -ge 11; then
132+
wheel_py_api=cp3$py_minor
133+
fi
134+
${PYBIN}/python -m build \
135+
--verbose \
136+
--wheel \
137+
--outdir dist \
138+
--no-isolation \
139+
--skip-dependency-check \
140+
--config-setting=cmake.define.ITK_DIR:PATH=${itk_build_dir} \
141+
--config-setting=cmake.define.WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING=PythonWheel \
142+
--config-setting=cmake.define.CMAKE_CXX_COMPILER_TARGET:STRING=$(uname -m)-linux-gnu \
143+
--config-setting=cmake.define.CMAKE_INSTALL_LIBDIR:STRING=lib \
144+
--config-setting=cmake.define.PY_SITE_PACKAGES_PATH:PATH="." \
145+
--config-setting=wheel.py-api=$wheel_py_api \
146+
--config-setting=cmake.define.BUILD_TESTING:BOOL=OFF \
147+
--config-setting=cmake.define.Python3_EXECUTABLE:FILEPATH=${Python3_EXECUTABLE} \
148+
--config-setting=cmake.define.Python3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} \
149+
${CMAKE_OPTIONS} \
150+
|| exit 1
111151
fi
112-
${PYBIN}/python setup.py clean
113-
${PYBIN}/python setup.py bdist_wheel --build-type Release -G Ninja -- \
114-
-DITK_DIR:PATH=${itk_build_dir} \
115-
-DWRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING=PythonWheel \
116-
-DCMAKE_CXX_COMPILER_TARGET:STRING=$(uname -m)-linux-gnu \
117-
-DCMAKE_INSTALL_LIBDIR:STRING=lib \
118-
-DBUILD_TESTING:BOOL=OFF \
119-
-DPython3_EXECUTABLE:FILEPATH=${Python3_EXECUTABLE} \
120-
-DPython3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} \
121-
${swig_args} ${CMAKE_OPTIONS} \
122-
|| exit 1
123152
done
124153

125154
# Convert list of excluded libs in --exclude_libs to auditwheel --exclude options
@@ -130,7 +159,9 @@ fi
130159
sudo ${Python3_EXECUTABLE} -m pip install auditwheel
131160
for whl in dist/*linux*$(uname -m).whl; do
132161
auditwheel repair ${whl} -w /work/dist/ ${AUDITWHEEL_EXCLUDE_ARGS}
133-
rm ${whl}
162+
if $use_skbuild_classic; then
163+
rm ${whl}
164+
fi
134165
done
135166

136167
if compgen -G "dist/itk*-linux*.whl" > /dev/null; then

0 commit comments

Comments
 (0)