Add support for using Python 3.6 interpreters (#18454)

Applies a patch to use Python 3.6 compatible types in our vendored
`packaging` implementation used in the interpreter query script. Adds
Python 3.6 and 3.7 test coverage in CI.
This commit is contained in:
Zanie Blue
2026-03-18 18:33:30 -05:00
committed by GitHub
parent 4419f9cd39
commit 42c85f654f
13 changed files with 429 additions and 48 deletions
+7 -7
View File
@@ -709,7 +709,7 @@ fn find_all_minor(
let minor = captures["minor"].parse().ok();
if let Some(minor) = minor {
// Optimization: Skip generally unsupported Python versions without querying.
if minor < 7 {
if minor < 6 {
return false;
}
// Optimization 2: Skip excluded Python (minor) versions without querying.
@@ -2793,23 +2793,23 @@ impl VersionRequest {
}
}
Self::MajorMinor(major, minor, _) => {
if (*major, *minor) < (3, 7) {
if (*major, *minor) < (3, 6) {
return Err(format!(
"Python <3.7 is not supported but {major}.{minor} was requested."
"Python <3.6 is not supported but {major}.{minor} was requested."
));
}
}
Self::MajorMinorPatch(major, minor, patch, _) => {
if (*major, *minor) < (3, 7) {
if (*major, *minor) < (3, 6) {
return Err(format!(
"Python <3.7 is not supported but {major}.{minor}.{patch} was requested."
"Python <3.6 is not supported but {major}.{minor}.{patch} was requested."
));
}
}
Self::MajorMinorPrerelease(major, minor, prerelease, _) => {
if (*major, *minor) < (3, 7) {
if (*major, *minor) < (3, 6) {
return Err(format!(
"Python <3.7 is not supported but {major}.{minor}{prerelease} was requested."
"Python <3.6 is not supported but {major}.{minor}{prerelease} was requested."
));
}
}
+2 -2
View File
@@ -922,9 +922,9 @@ pub enum InterpreterInfoError {
BrokenMacVer,
#[error("Unknown operating system: `{operating_system}`")]
UnknownOperatingSystem { operating_system: String },
#[error("Python {python_version} is not supported. Please use Python 3.8 or newer.")]
#[error("Python {python_version} is not supported. Please use Python 3.6 or newer.")]
UnsupportedPythonVersion { python_version: String },
#[error("Python executable does not support `-I` flag. Please use Python 3.8 or newer.")]
#[error("Python executable does not support `-I` flag. Please use Python 3.6 or newer.")]
UnsupportedPython,
#[error(
"Python installation is missing `distutils`, which is required for packaging on older Python versions. Your system may package it separately, e.g., as `python{python_major}-distutils` or `python{python_major}.{python_minor}-distutils`."