Skip to content

Commit 562dace

Browse files
committed
BUG: Bound the ITK dependency pin and repair the cleanup globs
The rewritten pin had no upper bound, so a wheel compiled against ITK 6 was satisfiable by ITK 7 or 8 with an incompatible ABI. Emit "itk >= 6.0, < 7" instead, and leave a module's pins alone when the ITK version is not MAJOR.MINOR, since no valid specifier can be built from a branch name. post_build_cleanup interpolated the whole package_env_config dict into two globs and searched the source checkout, so it matched nothing and silently removed neither the ITK build tree nor the caches. Point them at <build-dir-root>/build and <build-dir-root>/dist. Correct two docstrings that described the behaviour before it changed: delocate now repairs every wheel on both architectures, and a module dependency builds against the ITK tree already in use rather than re-extracting the cache.
1 parent 613223d commit 562dace

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

‎scripts/build_python_instance_base.py‎

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,15 @@ def rm(tree_path: Path):
584584
for p in base.glob("*.egg-info"):
585585
rm(p)
586586

587-
# 4) ITK build tree and tarballs
587+
# 4) ITK build tree and tarballs, both under the build root rather than
588+
# the source checkout: ITK-<platform-env>-<pixi-env>_<arch> in build/,
589+
# and the cache in dist/.
588590
target_arch = self.package_env_config["ARCH"]
589-
for p in base.glob(f"ITK-*-{self.package_env_config}_{target_arch}"):
591+
for p in (self.build_dir_root / "build").glob(f"ITK-*_{target_arch}"):
590592
rm(p)
591593

592594
# Tarballs
593-
for p in base.glob(f"ITKPythonBuilds-{self.package_env_config}*.tar.zst"):
595+
for p in (self.build_dir_root / "dist").glob("ITKPythonBuilds-*.tar*"):
594596
rm(p)
595597

596598
# 5) Optional module prerequisites cleanup (ITK_MODULE_PREQ)
@@ -792,19 +794,30 @@ def _update_module_itk_deps(pyproject_path: Path, itk_version: str) -> bool:
792794
# Tags carry a leading "v" and a pre-release or dev suffix
793795
# (e.g. v6.0rc01.dev20260915), neither of which belongs in the floor:
794796
# the wheel works with the whole 6.0 series, not one release candidate.
797+
# The pin is also bounded above: the wheel is compiled against this ITK
798+
# major series and its ABI, so the next major must not satisfy it.
795799
version_match = re.match(r"v?(\d+)\.(\d+)", itk_version)
796800
if version_match:
797801
min_floor = f"{version_match.group(1)}.{version_match.group(2)}"
802+
max_exclusive = str(int(version_match.group(1)) + 1)
798803
else:
799-
min_floor = itk_version
804+
# Not a version (e.g. a branch name): any pin built from it would
805+
# not be a valid specifier, so leave the module's pins alone.
806+
print(
807+
f" Leaving ITK pins in {pyproject_path.name} unchanged: "
808+
f"{itk_version!r} is not a MAJOR.MINOR version"
809+
)
810+
return False
800811

801812
changed = False
802813

803814
def _replace(m: re.Match) -> str:
804815
nonlocal changed
805816
changed = True
806817
pkg = m.group(1)
807-
return f'"{pkg} >= {min_floor}"'
818+
if max_exclusive is None:
819+
return f'"{pkg} >= {min_floor}"'
820+
return f'"{pkg} >= {min_floor}, < {max_exclusive}"'
808821

809822
new_text = pattern.sub(_replace, text)
810823
if changed:
@@ -1079,9 +1092,10 @@ def _build_module_dependencies(self):
10791092
- "InsightSoftwareConsortium/ITKMeshToPolyData@v0.10.0"
10801093
10811094
For each dependency, clone the repository, checkout the given tag,
1082-
invoke the platform download-cache-and-build script, then copy
1095+
build it against the ITK tree this build already uses, then copy
10831096
headers and wrapping input files into the current module tree
10841097
(include/ and wrapping/), similar to the bash implementations.
1098+
The cache is not downloaded or extracted again for a dependency.
10851099
"""
10861100

10871101
if len(self.itk_module_deps) == 0:

‎scripts/macos_build_python_instance.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
class MacOSBuildPythonInstance(BuildPythonInstanceBase):
99
"""macOS-specific wheel builder.
1010
11-
Handles macOS deployment target and architecture settings, and uses
12-
``delocate`` for wheel repair on x86_64 builds.
11+
Handles macOS deployment target and architecture settings, and repairs
12+
every wheel with ``delocate`` on both x86_64 and arm64.
1313
"""
1414

1515
def prepare_build_env(self) -> None:

0 commit comments

Comments
 (0)