Skip to content

chore(generator): add pyenv3wrapper script#17483

Merged
ohmayr merged 2 commits into
mainfrom
add-pyenv-wrapper
Jun 16, 2026
Merged

chore(generator): add pyenv3wrapper script#17483
ohmayr merged 2 commits into
mainfrom
add-pyenv-wrapper

Conversation

@ohmayr

@ohmayr ohmayr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This file is needed by the bazel build rules.

@ohmayr ohmayr requested a review from a team as a code owner June 16, 2026 17:04

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new shell script pyenv3wrapper.sh to execute python3 from the user's pyenv directory. The review feedback points out a portability issue on macOS where the getent command is unavailable, and suggests a fallback mechanism using the $HOME environment variable.

Comment on lines +3 to +4
HOME_DIR=$(getent passwd "$(whoami)" | cut -d: -f6)
exec "$HOME_DIR/.pyenv/shims/python3" "$@"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The getent command is not available on macOS by default. Running this script on macOS will result in a command not found error for getent, causing HOME_DIR to be empty and the script to fail when attempting to execute /.pyenv/shims/python3.

To make this script portable across both Linux and macOS, we should first attempt to use the $HOME environment variable, and fallback to getent or shell tilde expansion if $HOME is not set.

Suggested change
HOME_DIR=$(getent passwd "$(whoami)" | cut -d: -f6)
exec "$HOME_DIR/.pyenv/shims/python3" "$@"
HOME_DIR="${HOME:-$(getent passwd \"$(whoami)\" 2>/dev/null | cut -d: -f6)}"
HOME_DIR="${HOME_DIR:-$(eval echo \"~$(whoami)\")}"
exec "$HOME_DIR/.pyenv/shims/python3" "$@"

@ohmayr ohmayr enabled auto-merge (squash) June 16, 2026 17:06
@ohmayr ohmayr merged commit b254faf into main Jun 16, 2026
89 checks passed
@ohmayr ohmayr deleted the add-pyenv-wrapper branch June 16, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants