Skip to content

Commit 8a09f34

Browse files
authored
Repair wheel with auditwheel to ship relevant so files (#12)
1 parent 12839a2 commit 8a09f34

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

.github/workflows/linux_wheel.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ defaults:
2626
jobs:
2727

2828
generate-matrix:
29-
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
29+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@release/2.5
3030
with:
3131
package-type: wheel
3232
os: linux
3333
test-infra-repository: pytorch/test-infra
34-
test-infra-ref: main
34+
test-infra-ref: release/2.5
3535
with-xpu: disable
3636
with-rocm: disable
3737
with-cuda: disable
@@ -42,14 +42,15 @@ jobs:
4242
strategy:
4343
fail-fast: false
4444
name: Build and Upload Linux wheel
45-
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
45+
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@release/2.5
4646
with:
4747
repository: pytorch-labs/torchvision-extra-decoders
4848
ref: ""
4949
test-infra-repository: pytorch/test-infra
50-
test-infra-ref: main
50+
test-infra-ref: release/2.5
5151
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
5252
pre-script: packaging/pre_build_script.sh
5353
post-script: packaging/post_build_script.sh
54+
smoke-test-script: packaging/fake_smoke_test.py
5455
package-name: torchvision_extra_decoders
5556
trigger-event: ${{ github.event_name }}

packaging/fake_smoke_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This is a fake smoke test that runs on the test-infra instances after we build
2+
# a wheel.
3+
4+
print("Success")

packaging/post_build_script.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,30 @@
22

33
set -ex
44

5-
old="linux_x86_64"
5+
ls dist
6+
wheel_path=`find dist -type f -name "*.whl"`
7+
8+
echo Found $wheel_path
9+
10+
11+
# Put all the .so files we want to ship with the wheels within the lib_to_bundle
12+
# dir. Maybe it's enough to LD_LIBRARY_PATH $CONDA_PREFIX/lib but I fear this
13+
# might include some un-desired libc or libcxx so files?
14+
mkdir libs_to_bundle
15+
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
16+
echo `ls libs_to_bundle`
17+
export LD_LIBRARY_PATH="$PWD/libs_to_bundle:$LD_LIBRARY_PATH"
18+
19+
${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
20+
21+
# mv original wheel to a different dir, the 'repaired' wheel outputed by
22+
# auditwheel is still in dist/
23+
mkdir original_wheel
24+
mv $wheel_path original_wheel/
25+
26+
27+
# This is absolutely disgusting.
28+
old="manylinux_2_34_x86_64"
629
new="manylinux_2_17_x86_64.manylinux2014_x86_64"
730
echo "Replacing ${old} with ${new} in wheel name"
831
mv dist/*${old}*.whl $(echo dist/*${old}*.whl | sed "s/${old}/${new}/")

packaging/pre_build_script.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/bin/bash
22

3+
pip install auditwheel
34
conda install libavif libheif -c conda-forge -yq

0 commit comments

Comments
 (0)