File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 41
41
42
42
# Bundle external shared libraries into the wheels
43
43
for whl in " ${prjdir} " /dist/* .whl; do
44
+ " ${dir} /strip_wheel.sh" " $whl "
44
45
auditwheel repair " $whl " -w " $distdir "
45
46
done
46
47
Original file line number Diff line number Diff line change 41
41
42
42
# Bundle external shared libraries into the wheels
43
43
for whl in " ${prjdir} " /dist/* .whl; do
44
+ " ${dir} /strip_wheel.sh" " $whl "
44
45
auditwheel repair " $whl " -w " $distdir "
45
46
done
46
47
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Strip symbols inplace from the libraries in a zip archive.
4
+ #
5
+ # Stripping symbols is beneficial (reduction of 30% of the final package, >
6
+ # %90% of the installed libraries. However just running `auditwheel repair
7
+ # --strip` breaks some of the libraries included from the system, which fail at
8
+ # import with errors such as "ELF load command address/offset not properly
9
+ # aligned".
10
+ #
11
+ # System libraries are already pretty stripped. _psycopg2.so goes around
12
+ # 1.6M -> 300K (python 3.8, x86_64)
13
+ #
14
+ # This script is designed to run on a wheel archive before auditwheel.
15
+
16
+ set -euo pipefail
17
+ set -x
18
+
19
+ wheel=$( realpath " $1 " )
20
+ shift
21
+
22
+ # python or python3?
23
+ if which python > /dev/null; then
24
+ py=python
25
+ else
26
+ py=python3
27
+ fi
28
+
29
+ tmpdir=$( mktemp -d)
30
+ trap " rm -r ${tmpdir} " EXIT
31
+
32
+ cd " ${tmpdir} "
33
+ $py -m zipfile -e " ${wheel} " .
34
+
35
+ find . -name * .so -ls -exec strip " $@ " {} \;
36
+ # Display the size after strip
37
+ find . -name * .so -ls
38
+
39
+ $py -m zipfile -c " ${wheel} " *
40
+
41
+ cd -
You can’t perform that action at this time.
0 commit comments