-
Notifications
You must be signed in to change notification settings - Fork 0
/
vendor.sh
44 lines (36 loc) · 1.23 KB
/
vendor.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
mkdir -p build
cd build
# TODO: maybe build for 3.8 too to support importing from the new export format in Anki versions before 2.1.50
python_version=39
pyzstd_version=0.15.4
platforms=(
win_amd64
manylinux2014_x86_64
manylinux2014_aarch64
macosx_10_9_x86_64
# FIXME: the arm64 shared library has the same name as the x86_64 one (_zstd.cpython-39-darwin.so)
# How to handle such situation?
# macosx_11_0_arm64
)
# Download wheels
for platform in ${platforms[@]}; do
pip download pyzstd==$pyzstd_version --only-binary=:all: --python-version $python_version --implementation cp --platform $platform
done
# Create a shared wheel from an arbitrary platform-specific wheel
cp pyzstd-$pyzstd_version-cp$python_version-cp$python_version-${platforms[0]}.whl pyzstd.whl
# Unzip wheels
wheels=(pyzstd-$pyzstd_version-cp$python_version-*.whl pyzstd.whl)
for wheel in ${wheels[@]}; do
mkdir -p "${wheel%.*}"
pushd "${wheel%.*}"
unzip -o ../$wheel
popd
done
# Copy platform-specific library files to the shared wheel
for dir in pyzstd-$pyzstd_version-cp$python_version-*/; do
cp $dir/pyzstd/c/_zstd* pyzstd/pyzstd/c/
done
# Copy to vendor dir
mkdir -p ../src/vendor
cp -r ./pyzstd/* ../src/vendor