-
Notifications
You must be signed in to change notification settings - Fork 0
/
new-venv
executable file
·47 lines (41 loc) · 1.02 KB
/
new-venv
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
#!/bin/bash
# Function to log messages to stderr if $QUIET is not set
log () {
if (( $QUIET == 0 )) ; then
echo $1 1>&2
fi
}
# Set default values
QUIET=0
# Parse arguments
while [ "${#@}" -gt "0" ] ; do
opt=$1
case "$opt" in
-q|--quiet)
QUIET=1
;;
*)
echo "Unrecognized option, $opt"
;;
esac
shift
done
log "Removing old virtual environment"
# Deactivate the virtual environment if it is active
if which deactivate ; then
deactivate
fi
# Remove old venv, tox cache
for dir in venv .tox ; do
if [ -d "$dir" ] ; then
log " - Removing $dir"
rm -rf $dir
fi
done
log "Creating virtual environment"
python3 -m venv venv --system-site-packages
. venv/bin/activate
log "Installing adafruit shell and blinka"
pip install --upgrade adafruit-python-shell
wget -O raspi-blinka.py https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/raspi-blinka.py
sudo -E env PATH=$PATH python3 raspi-blinka.py