Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .evergreen/scripts/setup_uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
elsewhere on PATH may be invisible to later steps, so setup never accepts it
as-is.
This runs under the host's system python3, which may be older than our minimum supported version.
This runs under the host's system python3, which may be as old as Python 3.6 (RHEL 8).
Keep it free of __future__ imports and other 3.7+ syntax. test_setup_uv.py checks this.
"""

from __future__ import annotations

import os
import re
import shlex
Expand Down
15 changes: 15 additions & 0 deletions .evergreen/scripts/test_setup_uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from __future__ import annotations

import ast
import importlib.util
import os
import shutil
Expand Down Expand Up @@ -521,3 +522,17 @@ def test_main_pinned_self_overwrite_runs_from_copy(tmp_path, project):
assert proc.returncode == 0, proc.stderr
assert (bin_dir / "uv").exists()
assert f"installed-from=uv{PIN}\n" in log.read_text()


def test_setup_uv_supports_python_36():
"""setup_uv.py runs under the host's system python3, 3.6 on RHEL8 (PYTHON-6286)."""
# feature_version checks grammar only; it does not validate __future__
# feature names, so scan for those imports explicitly.
tree = ast.parse(SETUP_UV.read_text(), filename=str(SETUP_UV), feature_version=(3, 6))
futures = [
alias.name
for node in ast.walk(tree)
if isinstance(node, ast.ImportFrom) and node.module == "__future__"
for alias in node.names
]
assert not futures, f"Python 3.6 rejects these __future__ imports: {futures}"
Loading