-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_venv.sh
66 lines (54 loc) · 1.8 KB
/
install_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
#! /bin/bash
#
# install_venv.sh
#
# Copyright © 2014 Mathieu Gaborit (matael) <[email protected]>
# Updated to python3 by jblb <[email protected]>
#
# Distributed under WTFPL terms
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar <[email protected]>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
# 0. You just DO WHAT THE FUCK YOU WANT TO.
#
CORE_2_USE=2
PYTHON373_URL=https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
LOCALPYTHON=.localpython
PYTHON_DIRNAME=Python-3.7.3
VENV_DIR=.venv_pelican
INIT_PATH="$PWD"
echo "==> Testing for virtualenv..."
# test for virtualenv disponibility
virtualenv /tmp/test_venv_$PPID || ( echo "Please install virtualenv (sudo apt-get install python-virtualenv on Debian-based Linux)" ; exit )
rm -rf /tmp/test_venv_$PPID
echo "==> Creating dir $LOCALPYTHON to setup a new python install..."
mkdir $LOCALPYTHON
echo "==> Downloading and unpacking python_3.7.3..."
mkdir /tmp/python_$PPID && cd /tmp/python_$PPID
wget $PYTHON373_URL --quiet -O - | tar zx
cd $PYTHON_DIRNAME
echo "... Done."
echo "==> Running ./configure..."
./configure --prefix $INIT_PATH/$LOCALPYTHON
echo "==> Running make..."
make -j $CORE_2_USE PREFIX=$INIT_PATH/$LOCALPYTHON
make install
cd $INIT_PATH
echo "==> Creating bare virtualenv in $VENV_DIR ..."
virtualenv --python=$LOCALPYTHON/bin/python3 $VENV_DIR
echo "==> Activating venv..."
source $VENV_DIR/bin/activate
echo "==> Installing requirements..."
pip install -r requirements.txt
echo "==> Deactivating venv..."
deactivate