Repository navigation
PYTHON-6051 Convert drivers-evergreen-tools to a git submodule and pin the GitHub Actions reference #3095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+48
−17
Merged
PYTHON-6051 Convert drivers-evergreen-tools to a git submodule and pin the GitHub Actions reference #3095
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7b857b3
PYTHON-6051 Bump drivers-evergreen-tools to v1.2.0
blink1073 c697625
PYTHON-6051 Make setup-uv-python.sh robust to missing interpreters an…
blink1073 3e7943e
PYTHON-6051 Trim comments in setup-uv-python.sh
blink1073 4a83292
Revert "PYTHON-6051 Trim comments in setup-uv-python.sh"
blink1073 a33d24e
PYTHON-6051 Trim new comments in setup-uv-python.sh
blink1073 ee130e4
address review
blink1073 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,17 +14,33 @@ | |
| # 3.10 when the task does not set one. | ||
| set -euo pipefail | ||
|
|
||
| HERE=$(dirname ${BASH_SOURCE:-$0}) | ||
| HERE=$(dirname "${BASH_SOURCE:-$0}") | ||
| HERE="$( cd -- "$HERE" > /dev/null 2>&1 && pwd )" | ||
| ROOT=$(dirname "$(dirname "$HERE")") | ||
|
|
||
| # A .venv whose interpreter was removed breaks every `uv python find` and | ||
| # `uv sync`. It is a build artifact, so remove it and let `uv sync` recreate it. | ||
| # A removed base interpreter leaves a dangling symlink on Linux/macOS and a | ||
| # launcher that will not start on Windows, so probe by running the interpreter. | ||
| for _py in "$ROOT/.venv/bin/python3" "$ROOT/.venv/bin/python" "$ROOT/.venv/Scripts/python.exe"; do | ||
| if [ -e "$_py" ] || [ -L "$_py" ]; then | ||
| if ! "$_py" -c 'import sys' > /dev/null 2>&1; then | ||
| echo "Removing broken .venv (its interpreter will not start); uv sync will recreate it." | ||
| rm -rf "$ROOT/.venv" | ||
| fi | ||
| break | ||
| fi | ||
| done | ||
| unset _py | ||
|
|
||
| # Source the env files to pick up common variables. | ||
| if [ -f $HERE/env.sh ]; then | ||
| . $HERE/env.sh | ||
| if [ -f "$HERE/env.sh" ]; then | ||
| . "$HERE/env.sh" | ||
| fi | ||
|
|
||
| # Get variables defined in test-env.sh. | ||
| if [ -f $HERE/test-env.sh ]; then | ||
| . $HERE/test-env.sh | ||
| if [ -f "$HERE/test-env.sh" ]; then | ||
| . "$HERE/test-env.sh" | ||
| fi | ||
|
|
||
| # Default to a known-good Python so behavior is deterministic when a task does | ||
|
|
@@ -59,15 +75,30 @@ function _toolchain_dir() { | |
| } | ||
|
|
||
| # Make sure uv can provide the requested Python, downloading it if needed. | ||
| # If that fails, fall back to any available Python on local hosts; on CI, fail. | ||
| function _ensure_python() { | ||
| local request="$1" | ||
| if uv python find "$request" > /dev/null 2>&1; then | ||
| local request="$1" out _fallback | ||
| if out=$(uv python find "$request" 2>&1); then | ||
| return 0 | ||
| fi | ||
| echo "Python \"$request\" was not found on this host; asking uv to install it..." | ||
| # Show why find failed: e.g. an interpreter uv cannot run, or none at all. | ||
| echo "Python \"$request\" was not found on this host:" >&2 | ||
| sed 's/^/ /' <<<"$out" >&2 | ||
| echo "Asking uv to install Python \"$request\"..." | ||
| if uv python install "$request"; then | ||
| return 0 | ||
| fi | ||
| echo "uv could not install Python \"$request\"; looking for another interpreter..." | ||
| # Ignore UV_PYTHON and friends: they would steer the fallback right back to | ||
| # the broken interpreter. Local setup only: the Evergreen agent exports | ||
| # CI=true for every task command. | ||
| if [ "${CI:-}" != "true" ] && \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we care to check for Evergreen here (where this won't ever be true)?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It still could be true for a new version of python, like 3.16alpha |
||
| _fallback=$(env -u UV_PYTHON -u UV_PYTHON_SEARCH_PATH -u UV_PYTHON_PREFERENCE \ | ||
| uv python find ">=3.9" 2>/dev/null); then | ||
| echo "Using fallback interpreter: $_fallback" | ||
| export UV_PYTHON="$_fallback" | ||
| return 0 | ||
| fi | ||
| echo "ERROR: uv could not find or install Python \"$request\"." >&2 | ||
| return 1 | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule drivers-evergreen-tools
updated
47 files
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any interest in supporting Windows? 😄
E.g.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure why not. 😄