Dev setup for macOS: If pip3 installation fails, Homebrew is tried as a fallback if the user installed Python through Homebrew

This commit is contained in:
k8wu 2024-05-21 19:28:33 -04:00
parent 5a4a06d14e
commit 048dbe476b

View File

@ -156,8 +156,21 @@ rustup target add aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim x
# install cargo packages # install cargo packages
cargo install wasm-bindgen-cli wasm-pack cargo-edit cargo install wasm-bindgen-cli wasm-pack cargo-edit
# install pip packages # attempt to install pip packages - this may result in an error, which we will try to catch
pip3 install --upgrade bumpversion pip3 install --upgrade bumpversion || ( \
if [ $? -gt 0 ]; then
# it was probably because of the Python installation being externally managed, so we'll try to get the package via Homebrew, but only if Python was installed from there
echo "Installation via pip3 failed. Checking if Python was installed via Homebrew..."
if [[ ! -z $(brew list | grep python) ]]; then
echo "Python was installed from Homebrew. Installing bumpversion..."
$BREW_COMMAND install bumpversion && \
echo "[X] Bumpversion Python package installed" || \
echo "Failed to install the bumpversion Python package. Please install manually."
else
echo "Python was not installed from Homebrew. Please install the "bumpversion" Python package manually."
fi
fi
)
if command -v pod &>/dev/null; then if command -v pod &>/dev/null; then
echo '[X] CocoaPods is available in the path' echo '[X] CocoaPods is available in the path'