-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.sh
executable file
·43 lines (35 loc) · 1.15 KB
/
setup.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
#!/bin/bash
if [[ -d env ]]; then
source env/bin/activate
fi
echo "Checking python version..."
PYEXE="python"
PV=$($PYEXE -c "import sys; sys.stdout.write(str(sys.version_info.major));")
if [[ "$PV" != "3" ]]; then
echo 'Calling "python" does not run version 3, testing "python3"'
PYEXE="python3"
echo "Testing python3..."
$PYEXE -c "import sys"
rv=$?
if [[ $rv != 0 ]]; then
echo "Error: could not run $PYEXE. Please install Python 3 to continue"
exit 1
fi
fi
echo "Checking dependencies..."
$PYEXE -c "import pyatv, yaspin, inquirer, sponsorblock, yt_dlp; print ('Import test successful')"
rv=$?
if [[ $rv == 0 ]]; then
echo "Everything looks ok, try running \"./runme.sh\""
exit
fi
echo "Import test failed, attempting to install dependencies"
if [[ ! -d env ]]; then
$PYEXE -m venv env
source env/bin/activate
fi
# Switching from $PYEXE to python because venv should be active now
python -m pip install -r requirements.txt
echo "============================================================"
echo "Try running this script again. If you don't see any errors, try \"./runme.sh\""
echo "============================================================"