-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyinstall.sh
executable file
·69 lines (58 loc) · 2.05 KB
/
pyinstall.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
set -ex
du -shx $HOME/.cache/pip $HOME/.cache/pyenv $HOME/.cargo $HOME/.rustup \
$HOME/.manylinux_pip_cache $HOME/.manylinux_rustup_cache \
$HOME/.manylinux_cargo_cache || true
function pyenv_install() {
# Set up pyinstall and the virtualenv
PATH="$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH"
pyenv --version || true
if [ -d "$HOME/.pyenv/.git" ]; then
# for local testing
pushd "$HOME/.pyenv"
git pull
popd
else
rm -rf ~/.pyenv
git clone https://github.com/yyuu/pyenv.git $HOME/.pyenv
mkdir -p ~/.cache/pyenv/versions
ln -s ~/.cache/pyenv/versions ~/.pyenv/versions
fi
# make venvs for each version we want to test
rm -rf /tmp/.venv /tmp/pyenv_versions
IFS="," # allows iterating over csv string
for CURRENT_PYENV in $PYENV; do
echo "$CURRENT_PYENV" >> /tmp/pyenv_versions
done
# try and speed this up by installing in parallel
cat /tmp/pyenv_versions | xargs -L 1 -P 10 pyenv install --skip-existing
for CURRENT_PYENV in $PYENV; do
pyenv global $CURRENT_PYENV
pyenv rehash
python --version
pip install -q -U pip
pip install -q -U virtualenv
python -m venv "/tmp/.venv/${CURRENT_PYENV}" || python -m virtualenv "/tmp/.venv/${CURRENT_PYENV}"
set +x
source /tmp/.venv/${CURRENT_PYENV}/bin/activate
pip install -q -U pip
deactivate
set -x
done
}
if [[ $WHEELPLATFORM == *"manylinux"* ]]; then
echo "skipping pyenv install"
else
if [ -z ${PYENV+x} ]; then
# This is for local testing. You can change the default to match your system.
export PYENV='3.6.1'
echo "PYENV is not set. Defaulting to python $PYENV."
if [ ! -z ${TRAVIS_BUILD_NUMBER+x} ]; then
# should not see TRAVIS_BUILD_NUMBER if this is local testing.
echo "TARGET is not set but TRAVIS_BUILD_NUMBER is. Exiting with error"
exit 2
fi
else
echo "PYENV is $PYENV"
fi
pyenv_install
fi