Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix macOS itk wheel size explicitly removing _skbuild directory #256

Conversation

jcfr
Copy link
Contributor

@jcfr jcfr commented Jul 17, 2023

This commit works around an issue with the "clean" command (see [1]) that was not properly considering the current MACOSX_DEPLOYMENT_TARGET env. variable.

It does by explicitly deleting the scikit-build directory without relying on the "setup.py clean" command not respecting the selected deployment target.

Considering that

  1. the libraries installed while building the dependent itk-* wheels were accumulated in the install directory (e.g _skbuild/macosx-X.Y-<arch>-3.9/setuptools/lib)

  2. the wheel is generated by systematically archiving the content of the install directory. The manifest files are used to select which file to "copy" into the install directory but these are not used by the function creating the wheel archive. See [2]

  3. following scikit-build/scikit-build@ac9648bf4 (post 0.8.1), the platform name was properly considered on macOS only when building the wheel (using "setup.py build") but not when cleaning the build directory (using "setup.py clean")

... all the wheels depending on "itk-core" where unexpectedly large because there are including the cumulative set of files from all the wheels built beforehand.

[1] scikit-build/scikit-build#1012
[2] https://github.com/pypa/wheel/blob/0.40.0/src/wheel/wheelfile.py#L121-L141

jcfr and others added 2 commits July 16, 2023 22:33
This commit works around an issue with the "clean"
command (see [1]) that was not properly considering the current
MACOSX_DEPLOYMENT_TARGET env. variable.

It does by explicitly deleting the scikit-build directory
without relying on the "setup.py clean" command not respecting the
selected deployment target.

Considering that

1. the libraries installed while building the dependent itk-* wheels
   were accumulated in the install directory (e.g `_skbuild/macosx-X.Y-<arch>-3.9/setuptools/lib`)

2. the wheel is generated by systematically archiving the content of
   the install directory. The manifest files are used to select which
   file to "copy" into the install directory but these are not used
   by the function creating the wheel archive. See [2]

3. following scikit-build/scikit-build@ac9648bf4 (post 0.8.1), the
   platform name was properly considered on macOS *only* when
   building the wheel (using "setup.py build") but not when cleaning
   the build directory (using "setup.py clean")

... all the wheels depending on "itk-core" where unexpectedly large because
there are including the cumulative set of files from all the wheels built
beforehand.

[1] scikit-build/scikit-build#1012
[2] https://github.com/pypa/wheel/blob/0.40.0/src/wheel/wheelfile.py#L121-L141

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Matt McCormick <matt.mccormick@kitware.com>
@jcfr jcfr changed the base branch from master to release July 17, 2023 05:10
@jcfr jcfr changed the base branch from release to master July 17, 2023 05:12
@jcfr
Copy link
Contributor Author

jcfr commented Jul 17, 2023

@thewtex Builds using these branches have been started on both misty (amd64) and grax (arm64) build machines 🚀

@dzenanz dzenanz requested review from thewtex and tbirdso July 17, 2023 13:51
@dzenanz
Copy link
Member

dzenanz commented Jul 17, 2023

Looks good on a glance, but preferably someone else should review too.

Copy link
Contributor

@tbirdso tbirdso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @jcfr Thanks for the detailed explanation and issue link.

Copy link
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@thewtex thewtex merged commit 26d0b48 into InsightSoftwareConsortium:master Jul 17, 2023
@jcfr jcfr deleted the fix-macos-packaging-using-scikit-build-greater-8.1 branch July 17, 2023 15:43
@jcfr
Copy link
Contributor Author

jcfr commented Jul 17, 2023

For future reference, here is the comment from @thewtex

checking in the dist/ of both misty and grax the wheels are the right size!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants