2022-11-02 04:17:15 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-04-12 20:34:43 +00:00
|
|
|
pushd "$(dirname "$0")" || exit 1
|
2022-11-23 21:01:41 +00:00
|
|
|
|
2022-11-16 21:34:30 +00:00
|
|
|
py_command=python3
|
|
|
|
|
2023-04-12 20:34:43 +00:00
|
|
|
if ! type -P $py_command >/dev/null 2>&1; then
|
|
|
|
echo "No python3 found, using python."
|
|
|
|
py_command=python
|
2022-11-16 21:34:30 +00:00
|
|
|
fi
|
|
|
|
|
2022-11-02 04:17:15 +00:00
|
|
|
if [ -d "venv" ]; then
|
2023-04-12 20:34:43 +00:00
|
|
|
echo "Virtual environment will be reinstalled. Hit Enter to start."
|
|
|
|
read -r
|
|
|
|
echo "Deleting old venv..."
|
|
|
|
rm -rf venv
|
2022-11-02 04:17:15 +00:00
|
|
|
else
|
2023-04-12 20:34:43 +00:00
|
|
|
echo "If you do not know what this is, check the 'running from source' help. Hit Enter to start."
|
|
|
|
read -r
|
2022-11-02 04:17:15 +00:00
|
|
|
fi
|
|
|
|
|
2022-11-09 22:24:07 +00:00
|
|
|
echo "Users on Ubuntu <=20.04 equivalents or python >=3.10 need the advanced install."
|
2022-11-03 03:09:07 +00:00
|
|
|
echo
|
|
|
|
echo "Your Python version is:"
|
2022-11-16 21:34:30 +00:00
|
|
|
$py_command --version
|
2022-11-03 03:09:07 +00:00
|
|
|
echo
|
|
|
|
echo "Do you want the (s)imple or (a)dvanced install? "
|
|
|
|
|
2023-04-12 20:34:43 +00:00
|
|
|
read -r install_type
|
|
|
|
|
|
|
|
if [ "$install_type" = "s" ]; then
|
|
|
|
:
|
|
|
|
elif [ "$install_type" = "a" ]; then
|
|
|
|
echo
|
|
|
|
echo "If you are <=Ubuntu 18.04 or equivalent, choose 5."
|
|
|
|
echo "Do you want Qt(5), Qt(6), or (t)est? "
|
|
|
|
read -r qt
|
|
|
|
if [ "$qt" = "5" ]; then
|
|
|
|
:
|
|
|
|
elif [ "$qt" = "6" ]; then
|
|
|
|
:
|
|
|
|
elif [ "$qt" = "t" ]; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "Sorry, did not understand that input!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "If you are <=Ubuntu 20.04 or equivalent, you probably do not have libmpv1 0.34.1, so choose o."
|
|
|
|
echo "Do you want (o)ld mpv or (n)ew mpv? "
|
|
|
|
read -r mpv
|
|
|
|
if [ "$mpv" = "o" ]; then
|
|
|
|
:
|
|
|
|
elif [ "$mpv" = "n" ]; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "Sorry, did not understand that input!"
|
|
|
|
popd || exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
2023-04-24 21:17:07 +00:00
|
|
|
echo "If you are Python 3.10, choose n. >=3.11 should try the test"
|
|
|
|
echo "Do you want (o)ld OpenCV, (n)ew OpenCV, or (t)est OpenCV? "
|
2023-04-12 20:34:43 +00:00
|
|
|
read -r opencv
|
|
|
|
if [ "$opencv" = "o" ]; then
|
|
|
|
:
|
|
|
|
elif [ "$opencv" = "n" ]; then
|
|
|
|
:
|
2023-04-24 21:17:07 +00:00
|
|
|
elif [ "$opencv" = "t" ]; then
|
|
|
|
:
|
2023-04-12 20:34:43 +00:00
|
|
|
else
|
|
|
|
echo "Sorry, did not understand that input!"
|
|
|
|
popd || exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-11-03 03:09:07 +00:00
|
|
|
else
|
2023-04-12 20:34:43 +00:00
|
|
|
echo "Sorry, did not understand that input!"
|
|
|
|
popd || exit 1
|
|
|
|
exit 1
|
2022-11-03 03:09:07 +00:00
|
|
|
fi
|
|
|
|
|
2022-11-02 04:17:15 +00:00
|
|
|
echo "Creating new venv..."
|
2022-11-16 21:34:30 +00:00
|
|
|
$py_command -m venv venv
|
2022-11-02 04:17:15 +00:00
|
|
|
|
2023-04-12 20:34:43 +00:00
|
|
|
if ! source venv/bin/activate; then
|
2022-11-16 21:34:30 +00:00
|
|
|
echo "The venv failed to activate, stopping now!"
|
2023-04-12 20:34:43 +00:00
|
|
|
popd || exit 1
|
|
|
|
exit 1
|
2022-11-16 21:34:30 +00:00
|
|
|
fi
|
|
|
|
|
2022-11-02 04:17:15 +00:00
|
|
|
python -m pip install --upgrade pip
|
|
|
|
|
2022-11-16 21:34:30 +00:00
|
|
|
python -m pip install --upgrade wheel
|
2022-11-02 04:17:15 +00:00
|
|
|
|
2023-04-12 20:34:43 +00:00
|
|
|
if [ "$install_type" = "s" ]; then
|
|
|
|
python -m pip install -r requirements.txt
|
|
|
|
elif [ "$install_type" = "a" ]; then
|
|
|
|
python -m pip install -r static/requirements/advanced/requirements_core.txt
|
|
|
|
|
|
|
|
if [ "$qt" = "5" ]; then
|
|
|
|
python -m pip install -r static/requirements/advanced/requirements_qt5.txt
|
|
|
|
elif [ "$qt" = "6" ]; then
|
|
|
|
python -m pip install -r static/requirements/advanced/requirements_qt6.txt
|
|
|
|
elif [ "$qt" = "t" ]; then
|
|
|
|
python -m pip install -r static/requirements/advanced/requirements_qt6_test.txt
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$mpv" = "o" ]; then
|
2023-04-24 21:17:07 +00:00
|
|
|
python -m pip install -r static/requirements/advanced/requirements_mpv_old.txt
|
2023-04-12 20:34:43 +00:00
|
|
|
elif [ "$mpv" = "n" ]; then
|
2023-04-24 21:17:07 +00:00
|
|
|
python -m pip install -r static/requirements/advanced/requirements_mpv_new.txt
|
2023-04-12 20:34:43 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$opencv" = "o" ]; then
|
2023-04-24 21:17:07 +00:00
|
|
|
python -m pip install -r static/requirements/advanced/requirements_opencv_old.txt
|
2023-04-12 20:34:43 +00:00
|
|
|
elif [ "$opencv" = "n" ]; then
|
2023-04-24 21:17:07 +00:00
|
|
|
python -m pip install -r static/requirements/advanced/requirements_opencv_new.txt
|
|
|
|
elif [ "$opencv" = "t" ]; then
|
|
|
|
python -m pip install -r static/requirements/advanced/requirements_opencv_test.txt
|
2023-04-12 20:34:43 +00:00
|
|
|
fi
|
2022-11-03 03:09:07 +00:00
|
|
|
fi
|
2022-11-02 04:17:15 +00:00
|
|
|
|
|
|
|
deactivate
|
|
|
|
|
|
|
|
echo "Done!"
|
2022-11-23 21:01:41 +00:00
|
|
|
|
2023-04-12 20:34:43 +00:00
|
|
|
popd || exit
|