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

Repair wheel with auditwheel to ship relevant so files #12

Merged
merged 21 commits into from
Dec 5, 2024
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
9 changes: 5 additions & 4 deletions .github/workflows/linux_wheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ defaults:
jobs:

generate-matrix:
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@release/2.5
with:
package-type: wheel
os: linux
test-infra-repository: pytorch/test-infra
test-infra-ref: main
test-infra-ref: release/2.5
with-xpu: disable
with-rocm: disable
with-cuda: disable
Expand All @@ -42,14 +42,15 @@ jobs:
strategy:
fail-fast: false
name: Build and Upload Linux wheel
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@release/2.5
with:
repository: pytorch-labs/torchvision-extra-decoders
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
test-infra-ref: release/2.5
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
pre-script: packaging/pre_build_script.sh
post-script: packaging/post_build_script.sh
smoke-test-script: packaging/fake_smoke_test.py
package-name: torchvision_extra_decoders
trigger-event: ${{ github.event_name }}
4 changes: 4 additions & 0 deletions packaging/fake_smoke_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This is a fake smoke test that runs on the test-infra instances after we build
# a wheel.

print("Success")
25 changes: 24 additions & 1 deletion packaging/post_build_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,30 @@

set -ex

old="linux_x86_64"
ls dist
wheel_path=`find dist -type f -name "*.whl"`

echo Found $wheel_path


# Put all the .so files we want to ship with the wheels within the lib_to_bundle
# dir. Maybe it's enough to LD_LIBRARY_PATH $CONDA_PREFIX/lib but I fear this
# might include some un-desired libc or libcxx so files?
mkdir libs_to_bundle
for f in `find $CONDA_PREFIX/lib | grep -e libavif.so -e libdav1d.so -e librav1e.so -e libSvtAv1Enc.so -e libaom.so -e libheif.so -e libx265.so -e libde265.so`; do cp $f libs_to_bundle; done
echo `ls libs_to_bundle`
export LD_LIBRARY_PATH="$PWD/libs_to_bundle:$LD_LIBRARY_PATH"

${CONDA_RUN} auditwheel -v repair --plat manylinux_2_34_x86_64 $wheel_path --exclude libtorch_python.so --exclude libc10.so --exclude libtorch.so --exclude libtorch_cpu.so --wheel-dir dist

# mv original wheel to a different dir, the 'repaired' wheel outputed by
# auditwheel is still in dist/
mkdir original_wheel
mv $wheel_path original_wheel/


# This is absolutely disgusting.
old="manylinux_2_34_x86_64"
new="manylinux_2_17_x86_64.manylinux2014_x86_64"
echo "Replacing ${old} with ${new} in wheel name"
mv dist/*${old}*.whl $(echo dist/*${old}*.whl | sed "s/${old}/${new}/")
1 change: 1 addition & 0 deletions packaging/pre_build_script.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash

pip install auditwheel
conda install libavif libheif -c conda-forge -yq
Loading