forked from Legrandin/pycryptodome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis_install.sh
executable file
·96 lines (80 loc) · 2.45 KB
/
travis_install.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
set -x
sudo apt-get install libgmp10
if [ x${PYTHON_INTP} = "x" ]; then
echo "Undefined python implementation"
exit 1
fi
python --version
python2 --version
python3 --version
pyenv global
pyenv versions
if [ ${PYTHON_INTP} = "pypy" ]; then
sudo add-apt-repository -y ppa:pypy/ppa
sudo apt-get -y update
sudo apt-get install -y --force-yes pypy pypy-dev
elif [ ${PYTHON_INTP} = "python3.5" ]; then
pyenv global system 3.5
elif [ x$(which ${PYTHON_INTP}) = "x" ]; then
# Everything but Python 3.6
sudo add-apt-repository -y ppa:deadsnakes/ppa
# Python 3.6 only
sudo add-apt-repository -y ppa:jonathonf/python-3.6
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get -y update
sudo apt-get install ${PYTHON_INTP} ${PYTHON_INTP}-dev
fi
${PYTHON_INTP} -V
PYV=$(${PYTHON_INTP} -V 2>&1 | head -1 | sed -n 's/\w\+ \([23]\)\.\([0-9]\).*/\1\2/p')
export PYTHONPATH=${PWD}/custom_packages
mkdir ${PYTHONPATH}
# Use GCC 4.9 for building all extensions
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get -y update
sudo apt-get install gcc-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60
sudo update-alternatives --config gcc
sudo ln -f $(which gcc) $(which x86_64-linux-gnu-gcc)
# Ctypes was only included in python 2.5, so it needs to be installed if we target python 2.4.
# We do not rely on pypi because it refers us to sourceforge, not the most available site around.
# Instead, we mirror ctypes on github.
if [ ${PYV} -eq 24 ]; then
(
cd /tmp
git clone https://github.com/Legrandin/ctypes
cd ctypes
${PYTHON_INTP} setup.py build
cp -r build/lib*/* ${PYTHONPATH}
)
fi
# Use GCC 4.9 for building all extensions
sudo apt-get install gcc-4.9 g++-4.9
# Why bother with pip/virtualenv complexity when we can just do this
install_from_pypi() {
if [ "$2" = "latest" ]; then
target_version=".info.version"
else
target_version=\"$2\"
fi
URL=$(curl -s https://pypi.python.org/pypi/$1/json | jq '.releases['$target_version']' | jq -r 'map(select(.python_version == "source"))[0].url')
(
cd /tmp
wget -q "$URL"
FILENAME="$(basename ${URL})"
EXT="${FILENAME:(-3)}"
echo "Filename:" "$FILENAME" "(ext:${EXT})"
if [ "${EXT}" = "zip" ]; then
unzip "$FILENAME"
else
tar -xzf "$FILENAME"
fi
cd /tmp/$1-*
${PYTHON_INTP} setup.py build
cp -r build/lib*/* ${PYTHONPATH}
)
}
if [ x${CFFI} = "xyes" -a ${PYTHON_INTP} != "pypy" ]; then
install_from_pypi setuptools 19.4
install_from_pypi cffi latest
fi