forked from angr/angr-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpypy_venv.sh
executable file
·66 lines (52 loc) · 1.59 KB
/
pypy_venv.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
#!/usr/bin/env bash
set -e
NAME=$1
DIR=$(dirname $0)
cd $DIR
#sudo apt-get install cmake libreadline-dev
if [ -z "$NAME" ]; then
echo "use this script with ./pypy_venv <NAME>"
exit
fi
# setup
mkdir -p pypy
cd pypy
if [ -f "/etc/NIXOS" ]; then
echo "This is NixOS, using pypy from nix-shell"
set +e
source $(command -v virtualenvwrapper.sh)
mkvirtualenv -p $(command -v pypy3) $NAME
set -e
echo "installed pypy in $NAME"
exit 0
elif [ -f "/etc/arch-release" ]; then
echo "This is an arch distro"
ARCH=$(uname -m)
SUBVERSION=$(pacman -Si pypy3 | grep "Version\s*:\s*[0-9.\-]*" | grep -o "[0-9.\-]*")
VERSION=${2-pypy3-$SUBVERSION-$ARCH}
# get pypy
[ ! -e $VERSION.pkg.tar.xz ] && wget https://mirrors.kernel.org/archlinux/community/os/$ARCH/$VERSION.pkg.tar.xz
if [ ! -e $VERSION ]; then
tar xf $VERSION.pkg.tar.xz
mv ./opt/pypy3 ./$VERSION
fi
set +e
source /usr/bin/virtualenvwrapper.sh
set -e
else
if [ "$(uname)" == "Darwin" ]; then PYPY_OS=osx64; else PYPY_OS=linux64; fi
BEST_VERSION=$(wget https://bitbucket.org/pypy/pypy/downloads/ -O - | egrep -o 'href="/pypy/pypy/downloads/[^"]+' | cut -c 28- | grep "$PYPY_OS" | grep 'pypy3\.5' | head -n 1)
DOWNLOAD_URL=https://bitbucket.org/pypy/pypy/downloads/$BEST_VERSION
# get pypy
wget $DOWNLOAD_URL --local-encoding=utf-8 -O - | tar xj
set +e
source /etc/bash_completion.d/virtualenvwrapper
set -e
fi
# virtualenv
set +e
mkvirtualenv -p "$PWD/"pypy3.5-*/bin/pypy3 $NAME
set -e
pip install -U setuptools
echo "installed pypy in $NAME"
exit 0