Skip to content

Commit

Permalink
apacheGH-40749: [Python][Packaging] Strip unnecessary symbols when bu…
Browse files Browse the repository at this point in the history
…ilding wheels (apache#42028)

### Rationale for this change

Removing unnecessary symbols for wheels will allow us to reduce the size of the wheels considerably.

### What changes are included in this PR?

Running `strip --strip-debug` on Linux wheels for all *.so files.

### Are these changes tested?

Yes, via Archery.

### Are there any user-facing changes?

No
* GitHub Issue: apache#40749

Lead-authored-by: Raúl Cumplido <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
  • Loading branch information
raulcd and pitrou authored Jun 11, 2024
1 parent a81b7ef commit baf4089
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ci/scripts/python_wheel_manylinux_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,26 @@ export CMAKE_PREFIX_PATH=/tmp/arrow-dist
pushd /arrow/python
python setup.py bdist_wheel

echo "=== Strip symbols from wheel ==="
mkdir -p dist/temp-fix-wheel
mv dist/pyarrow-*.whl dist/temp-fix-wheel

pushd dist/temp-fix-wheel
wheel_name=$(ls pyarrow-*.whl)
# Unzip and remove old wheel
unzip $wheel_name
rm $wheel_name
for filename in $(ls pyarrow/*.so pyarrow/*.so.*); do
echo "Stripping debug symbols from: $filename";
strip --strip-debug $filename
done
# Zip wheel again after stripping symbols
zip -r $wheel_name .
mv $wheel_name ..
popd

rm -rf dist/temp-fix-wheel

echo "=== (${PYTHON_VERSION}) Tag the wheel with manylinux${MANYLINUX_VERSION} ==="
auditwheel repair -L . dist/pyarrow-*.whl -w repaired_wheels
popd

0 comments on commit baf4089

Please sign in to comment.