[Mac OS] Rewrite function download_with_retry (#8914)

* [Mac OS] Rewrite function download_with_retry

* Update powershell function DownloadWithRetry
This commit is contained in:
Vasilii Polikarpov
2023-11-30 13:39:32 +01:00
committed by GitHub
parent bf202afb1e
commit 5f5ab19246
25 changed files with 202 additions and 271 deletions

View File

@@ -10,19 +10,19 @@ echo "Installing Python Tooling"
if is_Monterey || is_BigSur; then
echo "Install latest Python 2"
Python2Url="https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg"
download_with_retries $Python2Url "/tmp" "python2.pkg"
python2_pkg=$(download_with_retry "https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg")
sudo installer -showChoiceChangesXML -pkg /tmp/python2.pkg -target / > /tmp/python2_choices.xml
choice_changes_xml=$(mktemp /tmp/python2_choice_changes.xml.XXXXXX)
sudo installer -showChoiceChangesXML -pkg "$python2_pkg" -target / | tee "$choice_changes_xml" > /dev/null
# To avoid symlink conflicts, remove tools installation in /usr/local/bin using installer choices
xmllint --shell /tmp/python2_choices.xml <<EOF
xmllint --shell "$choice_changes_xml" <<EOF
cd //array/dict[string[text()='org.python.Python.PythonUnixTools-2.7']]/integer
set 0
save
EOF
sudo installer -applyChoiceChangesXML /tmp/python2_choices.xml -pkg /tmp/python2.pkg -target /
sudo installer -applyChoiceChangesXML "$choice_changes_xml" -pkg "$python2_pkg" -target /
pip install --upgrade pip