-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.sh
45 lines (37 loc) · 1.22 KB
/
build.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
set -e
work_root=`dirname $0`
work_root=`cd ${work_root}; pwd`
requirements=${work_root}/requirements.txt
# Step 1 compile python
# 1.1 python source code
cd ${work_root}
if [ ! -f Python-2.7.13.tgz ]; then
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
fi
# 1.2 configure && make && make install
if [ ! -d ${work_root}/Python-2.7.13 ]; then
cd ${work_root}
tar xf ${work_root}/Python-2.7.13.tgz
fi
if [ -d ${work_root}/python-2.7-ucs4 ]; then
rm -rf ${work_root}/python-2.7-ucs4
fi
cd ${work_root}/Python-2.7.13
./configure --prefix=${work_root}/python-2.7-ucs4 --enable-unicode=ucs4
sed -i 's/#.*zlib zlibmodule.c/zlib zlibmodule.c/g' Modules/Setup
make -j20
make install
# 1.3 install pip
cd ${work_root}
if [ ! -f get-pip.py ]; then
curl -s https://bootstrap.pypa.io/get-pip.py -o ${work_root}/get-pip.py
fi
${work_root}/python-2.7-ucs4/bin/python ${work_root}/get-pip.py
# 1.4 install requirements
${work_root}/python-2.7-ucs4/bin/pip install -r ${requirements} -i https://mirrors.aliyun.com/pypi/simple
# 1.5 make python zip
if [ -f ${work_root}/python-2.7-ucs4.zip ]; then
rm -rf ${work_root}/python-2.7-ucs4.zip
fi
cd ${work_root}
zip -r -q ${work_root}/python-2.7-ucs4.zip python-2.7-ucs4