cmake-language-server: fix and cleanup

This commit is contained in:
Gaetan Lepage
2025-08-27 23:07:56 +02:00
parent a03ec2afdb
commit cb8df6ac63
2 changed files with 25 additions and 41 deletions
@@ -1,22 +1,26 @@
{
lib,
buildPythonApplication,
pythonOlder,
fetchFromGitHub,
# build-system
pdm-backend,
# dependencies
cmake-format,
pygls,
# tests
cmake,
pytest-datadir,
pytestCheckHook,
versionCheckHook,
}:
buildPythonApplication rec {
pname = "cmake-language-server";
version = "0.1.11";
format = "pyproject";
disabled = pythonOlder "3.8";
pyproject = true;
src = fetchFromGitHub {
owner = "regen100";
@@ -25,26 +29,34 @@ buildPythonApplication rec {
hash = "sha256-QxknG5NFYky6ZSjiIugLfHT4gXsyTBVbMMeULhQsmdk=";
};
patches = [
# Test timeouts occasionally cause the build to fail
./disable-test-timeouts.patch
];
# Test timeouts occasionally cause the build to fail
postPatch = ''
substituteInPlace tests/test_server.py \
--replace-fail \
"CALL_TIMEOUT = 2" \
"CALL_TIMEOUT = 10"
'';
nativeBuildInputs = [
build-system = [
pdm-backend
];
dontUseCmakeConfigure = true;
propagatedBuildInputs = [
dependencies = [
cmake-format
pygls
];
pythonImportsCheck = [ "cmake_language_server" ];
nativeCheckInputs = [
cmake
cmake-format
pytest-datadir
pytestCheckHook
versionCheckHook
];
versionCheckProgramArg = "--version";
# version.py generated by pdm, no idea why it's not present in test phase
# https://github.com/regen100/cmake-language-server/blob/v0.1.11/pyproject.toml#L35-L36
@@ -52,18 +64,12 @@ buildPythonApplication rec {
echo "__version__ = \"$PDM_BUILD_SCM_VERSION\"" > cmake_language_server/version.py
'';
dontUseCmakeConfigure = true;
pythonImportsCheck = [
"cmake_language_server"
];
meta = with lib; {
meta = {
description = "CMake LSP Implementation";
homepage = "https://github.com/regen100/cmake-language-server";
changelog = "https://github.com/regen100/cmake-language-server/releases/tag/${src.tag}";
license = licenses.mit;
maintainers = with maintainers; [ kira-bruneau ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ kira-bruneau ];
mainProgram = "cmake-language-server";
};
}
@@ -1,22 +0,0 @@
diff --git a/tests/test_server.py b/tests/test_server.py
index e6cfe6e..3a3ee6a 100644
--- a/tests/test_server.py
+++ b/tests/test_server.py
@@ -31,7 +31,7 @@ from pygls.server import LanguageServer
from cmake_language_server.server import CMakeLanguageServer
-CALL_TIMEOUT = 2
+CALL_TIMEOUT = None
def _init(client: LanguageServer, root: Path) -> None:
@@ -115,7 +115,7 @@ def test_workspace_did_change_configuration(
)
start = time.monotonic()
- while server._api is old_api and (time.monotonic() - start) < CALL_TIMEOUT:
+ while server._api is old_api:
time.sleep(0.1)
assert server._api is not None