Skip to content

Commit

Permalink
Replace auditwheel with bundling
Browse files Browse the repository at this point in the history
  • Loading branch information
tmi committed Feb 4, 2025
1 parent b36653c commit cab2bc3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,5 @@ data/bufr/*test
build/
*.back
trash

*swp
Binary file removed python_wrapper/.pre-compile.sh.swp
Binary file not shown.
9 changes: 5 additions & 4 deletions python_wrapper/post-build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

mkdir /tmp/eccodes/auditwheel
auditwheel repair -w /tmp/eccodes/auditwheel /tmp/eccodes/build/wheel/*whl
rm /tmp/eccodes/build/wheel/*whl
mv /tmp/eccodes/auditwheel/*whl /tmp/eccodes/build/wheel/
:
# 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
# auditwheel repair -w /tmp/eccodes/auditwheel /tmp/eccodes/build/wheel/*whl
17 changes: 16 additions & 1 deletion python_wrapper/pre-compile.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/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

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

## yum-available prereqs
for p in libaec-devel libpng-devel gobject-introspection-devel
Expand Down Expand Up @@ -29,6 +39,7 @@ cmake --build . --target install
cd -
cd /src/openjpeg && echo "$(git remote -v | head -1 | awk '{print $2;}') $(git rev-parse HEAD)" > /tmp/openjpeg/version.txt
cd -
cat /tmp/openjpeg/version.txt >> python_wrapper/src/versions.txt

## licenses
wget https://raw.githubusercontent.com/MathisRosenhauer/libaec/master/LICENSE.txt -O python_wrapper/src/copying/libaec.txt
Expand All @@ -37,5 +48,9 @@ wget https://raw.githubusercontent.com/glennrp/libpng/libpng16/LICENSE -O python
cp LICENSE python_wrapper/src/copying/libeccodes.txt
echo '{"libeccodes": {"path": "copying/libeccodes.txt", "home": "https://github.com/ecmwf/eccodes"}, "libaec": {"path": "copying/libaec.txt", "home": "https://github.com/MathisRosenhauer/libaec"}, "home": "https://github.com/uclouvain/openjpeg"}, "libpng": {"path": "copying/libpng.txt", "home": "https://github.com/glennrp/libpng"}}' > python_wrapper/src/copying/list.json

cat /tmp/openjpeg/version.txt >> python_wrapper/src/versions.txt
echo "$(git remote -v | head -1 | awk '{print $2;}') $(git rev-parse HEAD)" >> python_wrapper/src/versions.txt

cp /tmp/openjpeg/target/lib64/libopenjp2.so.7 /tmp/eccodes/target/eccodes/lib64/libopenjp2.so.7
cp /lib64/libaec.so.0 /tmp/eccodes/target/eccodes/lib64/libaec.so.0
cp /lib64/libpng16.so.16 /tmp/eccodes/target/eccodes/lib64/libpng16.so.16

0 comments on commit cab2bc3

Please sign in to comment.