Skip to content

Commit 6499a9c

Browse files
committed
exclude all
1 parent 647e692 commit 6499a9c

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

.github/workflows/paddle_wheel.yaml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,31 @@ jobs:
6767
- name: Repair wheel
6868
run: |
6969
pip install auditwheel
70-
# Dynamically find all library paths and add them to LD_LIBRARY_PATH
71-
FFMPEG_LIB_PATHS=$(find $(pwd)/build_cmake/_deps -type d -name "lib" | tr '\n' ':')
7270
73-
# Get PaddlePaddle library paths
71+
# 1. Extract internal libraries from the wheel to a temporary directory
72+
# This allows auditwheel to find them when checking dependencies
73+
mkdir -p temp_libs
74+
unzip -j dist/*.whl "torchcodec/*.so" -d temp_libs || true
75+
76+
# 2. Prepare LD_LIBRARY_PATH
77+
# FFmpeg libraries
78+
FFMPEG_LIB_PATHS=$(find $(pwd)/build_cmake/_deps -type d -name "lib" | tr '\n' ':')
79+
# PaddlePaddle libraries
7480
PADDLE_PATH=$(python -c "import paddle; print(paddle.__path__[0])")
7581
PADDLE_LIB_PATHS="$PADDLE_PATH/base:$PADDLE_PATH/libs"
82+
# Wheel internal libraries
83+
INTERNAL_LIB_PATH=$(pwd)/temp_libs
7684
77-
export LD_LIBRARY_PATH=${FFMPEG_LIB_PATHS}${PADDLE_LIB_PATHS}:${LD_LIBRARY_PATH}
78-
79-
# Dynamically generate exclude arguments for all FFmpeg libraries found
80-
EXCLUDE_ARGS=""
81-
for lib in $(find build_cmake/_deps -name "*.so.*" | xargs -n 1 basename | sort | uniq); do
82-
EXCLUDE_ARGS="$EXCLUDE_ARGS --exclude $lib"
83-
done
84-
85-
# Add PaddlePaddle libraries to exclude list
86-
EXCLUDE_ARGS="$EXCLUDE_ARGS --exclude libpaddle.so --exclude libcommon.so --exclude libphi_core.so"
85+
export LD_LIBRARY_PATH=${FFMPEG_LIB_PATHS}${PADDLE_LIB_PATHS}:${INTERNAL_LIB_PATH}:${LD_LIBRARY_PATH}
8786
88-
echo "Excluding libraries: $EXCLUDE_ARGS"
87+
# 3. Repair wheel with auditwheel
88+
# We exclude all external libraries because we want to rely on system libraries (like FFmpeg)
89+
# or libraries provided by other packages (like PaddlePaddle).
90+
# auditwheel 6.1.0+ supports wildcards in --exclude.
91+
auditwheel repair dist/*.whl --plat manylinux_2_28_x86_64 -w wheelhouse/ --exclude "*"
8992
90-
auditwheel repair dist/*.whl --plat manylinux_2_28_x86_64 -w wheelhouse/ $EXCLUDE_ARGS
93+
# Cleanup
94+
rm -rf temp_libs
9195
rm dist/*.whl
9296
mv wheelhouse/*.whl dist/
9397
rmdir wheelhouse

0 commit comments

Comments
 (0)