chore(lsprotocol): migrate to 2025.0.0 and cleanup artifacts

The changes align the project with the 2025.0.0 lsprotocol
release, removing the old backport and updating type hints
in the protocol hooks to use Sequence where appropriate. The
dist-info and packaging metadata for older lsprotocol
versions are replaced with the new 2025.0.0 artifacts.

- Remove exceptiongroup backport used on Python <3.11
- Use Sequence instead of List in LS protocol hooks
- Replace old dist-info with 2025.0.0 metadata
This commit is contained in:
Christoph Brandau
2026-09-03 08:39:12 +02:00
parent a0a0d38fe5
commit 53ebc5d055
101 changed files with 13838 additions and 7624 deletions
+34 -18
View File
@@ -7,10 +7,14 @@ import os
import re
import sys
import warnings
from typing import Generator, Iterator, NamedTuple, Sequence
from typing import TYPE_CHECKING, NamedTuple
from ._elffile import EIClass, EIData, ELFFile, EMachine
if TYPE_CHECKING:
import types
from collections.abc import Generator, Iterator, Sequence
EF_ARM_ABIMASK = 0xFF000000
EF_ARM_ABI_VER5 = 0x05000000
EF_ARM_ABI_FLOAT_HARD = 0x00000400
@@ -26,8 +30,6 @@ _ALLOWED_ARCHS = {
}
# `os.PathLike` not a generic type until Python 3.9, so sticking with `str`
# as the type for `path` until then.
@contextlib.contextmanager
def _parse_elf(path: str) -> Generator[ELFFile | None, None, None]:
try:
@@ -136,11 +138,11 @@ def _glibc_version_string_ctypes() -> str | None:
# glibc.
return None
# Call gnu_get_libc_version, which returns a string like "2.5"
# Call gnu_get_libc_version, which returns a string like "2.5".
gnu_get_libc_version.restype = ctypes.c_char_p
version_str: str = gnu_get_libc_version()
# py2 / py3 compatibility:
if not isinstance(version_str, str):
# A c_char_p restype comes back as bytes, so decode to text.
version_str: str | bytes = gnu_get_libc_version()
if isinstance(version_str, bytes):
version_str = version_str.decode("ascii")
return version_str
@@ -179,30 +181,44 @@ def _get_glibc_version() -> _GLibCVersion:
# From PEP 513, PEP 600
@functools.lru_cache(maxsize=1)
def _get_manylinux_module() -> types.ModuleType | None:
"""Return the ``_manylinux`` C extension module, or None if unavailable.
The result is cached for the lifetime of the process, since the presence
of the module does not change while running.
"""
try:
return __import__("_manylinux")
except ImportError:
return None
def _is_compatible(arch: str, version: _GLibCVersion) -> bool:
sys_glibc = _get_glibc_version()
if sys_glibc < version:
return False
# Check for presence of _manylinux module.
try:
import _manylinux # noqa: PLC0415
except ImportError:
manylinux_mod = _get_manylinux_module()
if manylinux_mod is None:
return True
if hasattr(_manylinux, "manylinux_compatible"):
result = _manylinux.manylinux_compatible(version[0], version[1], arch)
if hasattr(manylinux_mod, "manylinux_compatible"):
result = manylinux_mod.manylinux_compatible(version[0], version[1], arch)
if result is not None:
return bool(result)
return True
if version == _GLibCVersion(2, 5) and hasattr(_manylinux, "manylinux1_compatible"):
return bool(_manylinux.manylinux1_compatible)
if version == _GLibCVersion(2, 5) and hasattr(
manylinux_mod, "manylinux1_compatible"
):
return bool(manylinux_mod.manylinux1_compatible)
if version == _GLibCVersion(2, 12) and hasattr(
_manylinux, "manylinux2010_compatible"
manylinux_mod, "manylinux2010_compatible"
):
return bool(_manylinux.manylinux2010_compatible)
return bool(manylinux_mod.manylinux2010_compatible)
if version == _GLibCVersion(2, 17) and hasattr(
_manylinux, "manylinux2014_compatible"
manylinux_mod, "manylinux2014_compatible"
):
return bool(_manylinux.manylinux2014_compatible)
return bool(manylinux_mod.manylinux2014_compatible)
return True