forked from BYVoid/OpenCC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release-pypi-linux.sh
46 lines (37 loc) · 1.32 KB
/
release-pypi-linux.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
45
46
#!/bin/sh
set -e
# Different to release-pypi-win.cmd and release-pypi-osx.sh,
# this script has to be ran from a clean dockerfile
# Random note: The reason why this script is being ran from within a container
# is to ensure glibc compatibility. From what I've seen so far, it appears
# that having multiple glibc versions is a somewhat convoluted process
# and I don't trust myself to be able to manage them well.
# Download dependenciess
export DEBIAN_FRONTEND=noninteractive
apt update
apt upgrade -y
apt install -y g++ make curl
cd /opt/OpenCC
# Download and init conda
MINICONDA_FILENAME=Miniconda3-latest-Linux-x86_64.sh
curl -L -o $MINICONDA_FILENAME \
"https://repo.continuum.io/miniconda/$MINICONDA_FILENAME"
bash ${MINICONDA_FILENAME} -b -f -p $HOME/miniconda3
export PATH=$HOME/miniconda3/bin:$PATH
eval "$(conda shell.bash hook)"
for VERSION in 3.7 3.8 3.9 3.10; do
# Create and activate environment
conda create -y -n py$VERSION python=$VERSION
conda activate py$VERSION
# Build and package
pip install --no-cache-dir setuptools wheel cmake
python setup.py build_ext bdist_wheel \
--plat-name manylinux1_x86_64
# Cleanup
conda deactivate
rm -rf build python/opencc/clib OpenCC.egg-info
done
# Upload to PyPI
conda activate py3.8
python -m pip install twine
python -m twine upload dist/*