Skip to content

Python wheel: add lz4 #173

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

Merged
merged 3 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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="eckit"
CMAKE_PARAMS="-DENABLE_MPI=0 -DENABLE_ECKIT_GEO=1 -DENABLE_BUILD_TOOLS=OFF -DENABLE_AEC=0 -DENABLE_EIGEN=0"
CMAKE_PARAMS="-DENABLE_MPI=0 -DENABLE_ECKIT_GEO=1 -DENABLE_BUILD_TOOLS=OFF -DENABLE_AEC=0 -DENABLE_EIGEN=0 -DENABLE_LZ4=1"
PYPROJECT_DIR="python_wrapper"
DEPENDENCIES='[]'
21 changes: 21 additions & 0 deletions python_wrapper/post-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# NOTE in case of problems like we had with eccodes, replace with noop here
if [ "$(uname)" != "Darwin" ] ; then
auditwheel repair -w /tmp/eckit/auditwheel /tmp/eckit/build/wheel/*whl
cd /tmp/eckit/auditwheel
F=$(ls $whl)
unzip $F
patchelf --add-rpath '$ORIGIN' eckitlib.libs/*
rm $F
zip -r $F ./*
rm /tmp/eckit/build/wheel/*
mv /tmp/eckit/auditwheel/$F /tmp/eckit/build/wheel
cd -
fi

# NOTE on macos we delocate with impunity, because the findlibs recursive depload
# is disabled anyway
if [ "$(uname)" = "Darwin" ] ; then
delocate-wheel /tmp/eckit/build/wheel/*whl
fi
33 changes: 33 additions & 0 deletions python_wrapper/pre-compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/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

# note also that for macos, we assume that the agent has the libraries already installed, as we can't run this in docker
# we thus only prepare the license files

set -euo pipefail

mkdir -p python_wrapper/src/copying
mkdir -p /tmp/eckit/target/eckit/lib64/

if [ "$(uname)" != "Darwin" ] ; then
echo "no deps installation for platform $(uname)"
# echo "installing deps for platform $(uname)"
## lz4
# git clone https://github.com/lz4/lz4 /src/lz4 && cd /src/lz4
# make -j10 && make install DESTDIR=/tmp/lz4
# cd -
else
echo "no deps installation for platform $(uname)"
fi


wget https://raw.githubusercontent.com/lz4/lz4/dev/LICENSE -O python_wrapper/src/copying/liblz4.txt
echo '{"liblz4": {"path": "copying/liblz4.txt", "home": "https://github.com/lz4/lz4"}}' > python_wrapper/src/copying/list.json
Loading