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

Python wheel: add lz4 #173

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
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 .github/workflows/build-wheel-wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ on:
jobs:
python-wrapper-wheel:
name: Python Wrapper Wheel
uses: ecmwf-actions/reusable-workflows/.github/workflows/python-wrapper-wheel.yml@main
uses: ecmwf/reusable-workflows/.github/workflows/python-wrapper-wheel.yml@main
secrets: inherit
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"
CMAKE_PARAMS="-DENABLE_MPI=0 -DENABLE_ECKIT_GEO=1 -DENABLE_BUILD_TOOLS=OFF -DENABLE_AEC=0 -DLZ4_INCLUDE_DIR=/tmp/lz4/usr/local/include/ -DLZ4_LIBRARY=/tmp/lz4/usr/local/lib/ -DENABLE_LZ4=1"
PYPROJECT_DIR="python_wrapper"
DEPENDENCIES='[]'
14 changes: 14 additions & 0 deletions python_wrapper/post-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/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
rm /tmp/eckit/build/wheel/*
mv /tmp/eckit/auditwheel/* /tmp/eckit/build/wheel
fi

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