Better error for unsupported Python version (#3398)

Fixes #3371

It seems like uv doesn't proactively enforce 3.8+ and in most cases just
issues a warning. This PR keeps that property, only adding the new check
when it is known to fail. I checked the imports in this file and the
other ones seem fine.
This commit is contained in:
Shantanu 2024-05-06 02:12:36 -07:00 committed by GitHub
parent 9de49c8a60
commit 95f31f2266
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 4 deletions

View file

@ -22,7 +22,15 @@ def format_full_version(info):
if sys.version_info[0] < 3:
print(json.dumps({"result": "error", "kind": "unsupported_python_version"}))
print(
json.dumps(
{
"result": "error",
"kind": "unsupported_python_version",
"python_version": format_full_version(sys.version_info),
}
)
)
sys.exit(0)
if hasattr(sys, "implementation"):
@ -435,6 +443,18 @@ def get_operating_system_and_architecture():
architecture = version_arch
if operating_system == "linux":
if sys.version_info < (3, 7):
print(
json.dumps(
{
"result": "error",
"kind": "unsupported_python_version",
"python_version": format_full_version(sys.version_info),
}
)
)
sys.exit(0)
# noinspection PyProtectedMember
from .packaging._manylinux import _get_glibc_version