jthegedus / asdf-gcloud

☁️ GCloud CLI (Google Cloud SDK) plugin for asdf version manager. Pin gcloud versions for each project!
https://asdf-vm.com
MIT License
55 stars 22 forks source link

fix: check for both python3 and python in exec-env #78

Closed adamfeldman closed 1 year ago

adamfeldman commented 1 year ago

This fix enables the use of Homebrew-installed Python with this plugin.

See also 9d7ff92 for an earlier commit that adjusted python --> python3.

Description

Changes bin/exec-env to check for python3 instead of python.

Motivation and Context

Not working, on macOS with Homebrew-installed Python:

➜ ~ gcloud --version 🚨 Python not found and is required for gcloud. Might I suggest https://github.com/danhper/asdf-python ➜ ~ command -v python ➜ ~ ➜ ~ command -v python3 /opt/homebrew/bin/python3

An alias doesn't fix it either:

➜ ~ command -v python alias python=python3 ➜ ~ command -v python3 /opt/homebrew/bin/python3 ➜ ~ gcloud help
🚨 Python not found and is required for gcloud. Might I suggest https://github.com/danhper/asdf-python ➜ ~ which python python: aliased to python3 ➜ ~ which python3 /opt/homebrew/bin/python3

After applying the change, it works:

➜ ~ gcloud --version Google Cloud SDK 433.0.0 bq 2.0.93 core 2023.05.26 gcloud-crc32c 1.0.0 gsutil 5.24

Types of changes

Usage examples

How Has This Been Tested?

Checklist:

jthegedus commented 1 year ago

Thanks for the PR @adamfeldman

I made a change so that it prefers python3 but if it is not found falls back to python.

adamfeldman commented 1 year ago

Awesome, thank you @jthegedus!

jthegedus commented 1 year ago

Sorry for the delay :sweat_smile:

adamfeldman commented 1 year ago

You were plenty quick! Thank you for maintaining this! 😄 🚀