Skip to content

Commit 4d07821

Browse files
committed
Merge branch 'release'
2 parents 4df00ef + 7b99a16 commit 4d07821

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

scripts/macpython-build-module-wheels.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ fi
7171

7272
VENV="${VENVS[0]}"
7373
Python3_EXECUTABLE=${VENV}/bin/python3
74+
dot_clean ${VENV}
7475
${Python3_EXECUTABLE} -m pip install --no-cache delocate
7576
DELOCATE_LISTDEPS=${VENV}/bin/delocate-listdeps
7677
DELOCATE_WHEEL=${VENV}/bin/delocate-wheel

scripts/macpython-build-tarball.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ if test $(arch) == "arm64"; then
1313
fi
1414

1515
pushd /Users/svc-dashboard/D/P > /dev/null
16+
dot_clean ITKPythonPackage
1617
tar -cf ITKPythonBuilds-macosx${arch_postfix}.tar \
1718
ITKPythonPackage/ITK-* \
1819
${tbb_contents} \

scripts/macpython-download-cache-and-build-module-wheels.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ if [[ ! -f ITKPythonBuilds-macosx${tarball_arch}.tar.zst ]]; then
5555
fi
5656
unzstd --long=31 ITKPythonBuilds-macosx${tarball_arch}.tar.zst -o ITKPythonBuilds-macosx${tarball_arch}.tar
5757
PATH="$(dirname $(brew list gnu-tar | grep gnubin)):$PATH"
58-
gtar xf ITKPythonBuilds-macosx${tarball_arch}.tar --checkpoint=10000 --checkpoint-action=dot \
58+
gtar xf ITKPythonBuilds-macosx${tarball_arch}.tar --warning=no-unknown-keyword --checkpoint=10000 --checkpoint-action=dot \
5959
ITKPythonPackage/ITK-source \
6060
ITKPythonPackageRequiredExtractionDir.txt \
6161
ITKPythonPackage/scripts
@@ -64,7 +64,7 @@ gtar xf ITKPythonBuilds-macosx${tarball_arch}.tar --checkpoint=10000 --checkpoin
6464
args=( "$@" )
6565
source ITKPythonPackage/scripts/macpython-build-common.sh
6666
for version in "$PYTHON_VERSIONS"; do
67-
gtar xf ITKPythonBuilds-macosx${tarball_arch}.tar --checkpoint=10000 --checkpoint-action=dot \
67+
gtar xf ITKPythonBuilds-macosx${tarball_arch}.tar --warning=no-unknown-keyword --checkpoint=10000 --checkpoint-action=dot \
6868
--wildcards "ITKPythonPackage/ITK-${version}-macosx*" \
6969
"ITKPythonPackage/venvs/${version}"
7070
done

scripts/windows_build_module_wheels.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,15 @@ def build_wheels(py_envs=DEFAULT_PY_ENVS, cleanup=True, cmake_options=[]):
125125
if cleanup:
126126
check_call([python_executable, "setup.py", "clean"])
127127

128-
def rename_wheel_init(py_env, filepath):
128+
def rename_wheel_init(py_env, filepath, add_module_name=True):
129129
"""
130-
Rename module __init__ file in wheel.
131-
This is required to prevent modules to override ITK's __init__ file on install.
132-
If the module ships its own __init__ file, it is automatically renamed to
133-
__init_{module_name}__ by this function. The renamed __init__ file will be executed
134-
by ITK's __init__ file when loading ITK.
130+
Rename module __init__ (if add_module_name is True) or __init_module__ (if
131+
add_module_name is False) file in wheel. This is required to prevent
132+
modules to override ITK's __init__ file on install or to prevent delvewheel
133+
to override __init_module__ file. If the module ships its own __init__
134+
file, it is automatically renamed to __init_{module_name}__ by this
135+
function. The renamed __init__ file will be executed by ITK's __init__ file
136+
when loading ITK.
135137
"""
136138
python_executable, python_include_dir, python_library, pip, ninja_executable, path = venv_paths(py_env)
137139

@@ -145,11 +147,15 @@ def rename_wheel_init(py_env, filepath):
145147
wheel_dir = os.path.join(dist_dir, "itk_" + module_name.replace('-','_') + "-" + module_version)
146148
init_dir = os.path.join(wheel_dir, "itk")
147149
init_file = os.path.join(init_dir, "__init__.py")
150+
init_file_module = os.path.join(init_dir, "__init_" + module_name.split("-")[0] + "__.py")
148151

149152
# Unpack wheel and rename __init__ file if it exists.
150153
check_call([python_executable, "-m", "wheel", "unpack", filepath, "-d", dist_dir])
151-
if os.path.isfile(init_file):
152-
shutil.move(init_file, os.path.join(init_dir, "__init_" + module_name + "__.py"))
154+
if add_module_name and os.path.isfile(init_file):
155+
shutil.move(init_file, init_file_module)
156+
if not add_module_name and os.path.isfile(init_file_module):
157+
shutil.move(init_file_module, init_file)
158+
153159
# Pack wheel and clean wheel folder
154160
check_call([python_executable, "-m", "wheel", "pack", wheel_dir, "-d", dist_dir])
155161
shutil.rmtree(wheel_dir)
@@ -160,6 +166,10 @@ def fixup_wheel(py_envs, filepath, lib_paths:str='', exclude_libs:str=''):
160166

161167
py_env = py_envs[0]
162168

169+
# Make sure the module __init_module__.py file has the expected name for
170+
# delvewheel, i.e., __init__.py.
171+
rename_wheel_init(py_env, filepath, False)
172+
163173
delve_wheel = os.path.join("C:/P/IPP", "venv-" + py_env, "Scripts", "delvewheel.exe")
164174
check_call([delve_wheel, "repair", "--no-mangle-all", "--add-path",
165175
lib_paths, "--no-dll", exclude_libs, "--ignore-in-wheel", "-w",

0 commit comments

Comments
 (0)