Use --break-system-packages with pip

Unfortunately, both versions of `pip` don't have this flag.

Check the version, then add the flag if it is not too old.
This commit is contained in:
tcely 2025-01-21 03:08:24 -05:00 committed by GitHub
parent 66e5192980
commit 1f95b858f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,5 +26,13 @@ pip3() {
warning_message
test -n "${TUBESYNC_DEBUG}" || exit 1
pip3 install --upgrade --break-system-packages yt-dlp
# Use the flag added in 23.0.1, if possible.
# https://github.com/pypa/pip/pull/11780
break_system_packages='--break-system-packages'
pip_version="$(pip3 --version | awk '$1 = "pip" { print $2; exit; }')"
if [[ "${pip_version}" < "23.0.1" ]]; then
break_system_packages=''
fi
pip3 install --upgrade ${break_system_packages} yt-dlp