Skip to content

Commit

Permalink
Python wheel: add qhull dep
Browse files Browse the repository at this point in the history
  • Loading branch information
tmi committed Feb 17, 2025
1 parent 222fb87 commit 40a7373
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python_wrapper/buildconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
# TODO we duplicate information -- pyproject.toml's `name` and `packages` are derivable from $NAME and must stay consistent

NAME="atlas"
CMAKE_PARAMS="-Deckit_ROOT=/tmp/atlas/prereqs/eckitlib" # -DENABLE_TESSELATION=1" # TODO tesselation requires Qhull in precompile
CMAKE_PARAMS="-Deckit_ROOT=/tmp/atlas/prereqs/eckitlib -DQhull_ROOT=/tmp/qhull/target -DENABLE_TESSELATION=1"
PYPROJECT_DIR="python_wrapper"
DEPENDENCIES='["eckitlib"]'
10 changes: 10 additions & 0 deletions python_wrapper/post-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# NOTE auditwheel is problematic since it changes libnames -- all is well from
# the pov # of this very package's libs, but subsequent packages compiled with
# this as a dependency end up not working
# if [ "$(uname)" != "Darwin" ] ; then
# auditwheel repair -w /tmp/eccodes/auditwheel /tmp/eccodes/build/wheel/*whl
# fi

# TODO macos we actually need to use the `otool` here
6 changes: 5 additions & 1 deletion python_wrapper/post-compile.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash

# NOTE we need to strip here because vanilla atlas is for some reason huge
# We don't strip in general since that has caused some linker problem downstream, but here so far seems to work

if [ "$(uname)" != "Darwin" ] ; then
strip --strip-unneeded /tmp/atlas/target/atlas/lib64/libatlas.so
else
strip --strip-unneeded /tmp/atlas/target/atlas/lib/libatlas.so # TODO test this
strip --strip-unneeded -x /tmp/atlas/target/atlas/lib/libatlas.dylib
fi
21 changes: 21 additions & 0 deletions python_wrapper/pre-compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# the procedure for adding a new ext dependency to be bundled in here:
# - add git checkout, compile, etc
# - ensure the version ends up in python_wrapper/src/versions.txt
# - ensure the licence ends up in python_wrapper/src/copying/, and fname is referenced in copying/list.json
# - ensure the .so ends up in target/lib64/ with the expected libname
# - validate that the resulting wheel contains all the above
# additionally, make sure this script is aligned with /buildscripts/compile.sh and /buildscripts/wheel-linux.sh,
# in particular when it comes to install targets and package data, etc

bash ./tools/install-qhull.sh --prefix /tmp/qhull/target
# copy the libs, instead of having auditwheel done it later. This is a bit risky because cmake will later write in this
# very directory... but it works
cp /tmp/qhull/target/lib/libqhull_r.* /tmp/atlas/target/atlas/lib64/

wget https://raw.githubusercontent.com/qhull/qhull/blob/master/COPYING.txt -O python_wrapper/src/copying/libqhull.txt
echo '{"libqhull_r": {"path": "copying/libqhull.txt", "home": "https://github.com/qhull/qhull"}}' > python_wrapper/src/copying/list.json



0 comments on commit 40a7373

Please sign in to comment.