2022-11-02 04:17:15 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-11-23 21:01:41 +00:00
|
|
|
pushd "$(dirname "$0")"
|
|
|
|
|
2022-11-16 21:34:30 +00:00
|
|
|
py_command=python3
|
|
|
|
|
|
|
|
type -P $py_command
|
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "No python3 found, using python."
|
|
|
|
py_command=python
|
|
|
|
fi
|
|
|
|
|
2022-11-02 04:17:15 +00:00
|
|
|
if [ -d "venv" ]; then
|
|
|
|
echo "Virtual environment will be reinstalled. Hit Enter to start."
|
|
|
|
read
|
|
|
|
echo "Deleting old venv..."
|
|
|
|
rm -rf venv
|
|
|
|
else
|
|
|
|
echo "If you do not know what this is, check the 'running from source' help. Hit Enter to start."
|
|
|
|
read
|
|
|
|
fi
|
|
|
|
|
2022-11-03 03:09:07 +00:00
|
|
|
echo "The precise version limits for macOS are not yet fully known. Please try the advanced install and let hydev know what works for you."
|
|
|
|
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? "
|
|
|
|
|
|
|
|
read install_type
|
|
|
|
|
|
|
|
if [ $install_type = "s" ]; then
|
|
|
|
:
|
|
|
|
elif [ $install_type = "a" ]; then
|
|
|
|
echo
|
|
|
|
echo "If you are <= 10.13 (High Sierra), choose 5."
|
|
|
|
echo "Do you want Qt(5) or Qt(6)? "
|
|
|
|
read qt
|
|
|
|
if [ $qt = "5" ]; then
|
|
|
|
:
|
|
|
|
elif [ $qt = "6" ]; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "Sorry, did not understand that input!"
|
2022-11-23 21:01:41 +00:00
|
|
|
popd
|
2022-11-03 03:09:07 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "mpv is broken on macOS. As a safe default, choose n."
|
|
|
|
echo "Do you want (o)ld mpv or (n)ew mpv? "
|
|
|
|
read mpv
|
|
|
|
if [ $mpv = "o" ]; then
|
|
|
|
:
|
|
|
|
elif [ $mpv = "n" ]; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "Sorry, did not understand that input!"
|
2022-11-23 21:01:41 +00:00
|
|
|
popd
|
2022-11-03 03:09:07 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "If you are >=Python 3.10, choose n."
|
|
|
|
echo "Do you want (o)ld OpenCV or (n)ew OpenCV? "
|
|
|
|
read opencv
|
|
|
|
if [ $opencv = "o" ]; then
|
|
|
|
:
|
|
|
|
elif [ $opencv = "n" ]; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "Sorry, did not understand that input!"
|
2022-11-23 21:01:41 +00:00
|
|
|
popd
|
2022-11-03 03:09:07 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Sorry, did not understand that input!"
|
2022-11-23 21:01:41 +00:00
|
|
|
popd
|
2022-11-03 03:09:07 +00:00
|
|
|
exit 1
|
|
|
|
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
|
|
|
|
|
|
|
source venv/bin/activate
|
|
|
|
|
2022-11-16 21:34:30 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "The venv failed to activate, stopping now!"
|
2022-11-23 21:01:41 +00:00
|
|
|
popd
|
2022-11-16 21:34:30 +00:00
|
|
|
exit 1
|
|
|
|
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
|
|
|
|
2022-11-03 03:09:07 +00:00
|
|
|
if [ $install_type = "s" ]; then
|
2022-11-16 21:34:30 +00:00
|
|
|
python -m pip install -r requirements.txt
|
2022-11-03 03:09:07 +00:00
|
|
|
elif [ $install_type = "a" ]; then
|
2022-11-16 21:34:30 +00:00
|
|
|
python -m pip install -r static/requirements/advanced/requirements_core.txt
|
2022-11-03 03:09:07 +00:00
|
|
|
|
|
|
|
if [ $qt = "5" ]; then
|
2022-11-16 21:34:30 +00:00
|
|
|
python -m pip install -r static/requirements/advanced/requirements_qt5.txt
|
2022-11-03 03:09:07 +00:00
|
|
|
elif [ $qt = "6" ]; then
|
2022-11-16 21:34:30 +00:00
|
|
|
python -m pip install -r static/requirements/advanced/requirements_qt6.txt
|
2022-11-03 03:09:07 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $mpv = "o" ]; then
|
2022-11-16 21:34:30 +00:00
|
|
|
python -m pip install -r static/requirements/advanced/requirements_old_mpv.txt
|
2022-11-03 03:09:07 +00:00
|
|
|
elif [ $mpv = "n" ]; then
|
2022-11-16 21:34:30 +00:00
|
|
|
python -m pip install -r static/requirements/advanced/requirements_new_mpv.txt
|
2022-11-03 03:09:07 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $opencv = "o" ]; then
|
2022-11-16 21:34:30 +00:00
|
|
|
python -m pip install -r static/requirements/advanced/requirements_old_opencv.txt
|
2022-11-03 03:09:07 +00:00
|
|
|
elif [ $opencv = "n" ]; then
|
2022-11-16 21:34:30 +00:00
|
|
|
python -m pip install -r static/requirements/advanced/requirements_new_opencv.txt
|
2022-11-03 03:09:07 +00:00
|
|
|
fi
|
|
|
|
fi
|
2022-11-02 04:17:15 +00:00
|
|
|
|
|
|
|
deactivate
|
|
|
|
|
|
|
|
echo "Done!"
|
|
|
|
|
|
|
|
read
|
2022-11-23 21:01:41 +00:00
|
|
|
|
|
|
|
popd
|