python3Packages.tree-sitter-language-pack: 0.6.1 -> 0.7.3, add check and update script (#409016)

authored by Yt and committed by GitHub 95f00cc0 b5bd640a

+34 -7
-3
pkgs/development/python-modules/aider-chat/default.nix
··· 285 285 "test_main_exit_calls_version_check" 286 286 # AssertionError: assert 2 == 1 287 287 "test_simple_send_non_retryable_error" 288 - # Broken tests (Aider-AI/aider#3679) 289 - "test_language_ocaml" 290 - "test_language_ocaml_interface" 291 288 ] 292 289 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 293 290 # Tests fails on darwin
+34 -4
pkgs/development/python-modules/tree-sitter-language-pack/default.nix
··· 2 2 lib, 3 3 buildPythonPackage, 4 4 fetchPypi, 5 + python, 6 + nix-update-script, 5 7 6 8 # build-system 7 9 cython, ··· 17 19 18 20 buildPythonPackage rec { 19 21 pname = "tree-sitter-language-pack"; 20 - version = "0.6.1"; 22 + version = "0.7.3"; 21 23 pyproject = true; 22 24 23 25 # Using the GitHub sources necessitates fetching the treesitter grammar parsers by using a vendored script: ··· 26 28 src = fetchPypi { 27 29 pname = "tree_sitter_language_pack"; 28 30 inherit version; 29 - hash = "sha256-pGNfW2ubZCVi2QHk6qJfyClJ1mDIi5R1Pm1GfZY0Ark="; 31 + hash = "sha256-SROctgfYE1LTOtGOV1IPwQV6AJlVyczO1WYHzBjmo/0="; 30 32 }; 31 33 32 34 build-system = [ ··· 42 44 tree-sitter-yaml 43 45 ]; 44 46 47 + prePatch = '' 48 + # Remove the packaged bindings, which only work on Linux and prevent the build from succeeding 49 + # https://github.com/Goldziher/tree-sitter-language-pack/issues/46 50 + rm -rf tree_sitter_language_pack/bindings/*.so 51 + ''; 52 + 45 53 pythonImportsCheck = [ 46 54 "tree_sitter_language_pack" 47 55 "tree_sitter_language_pack.bindings" 48 56 ]; 49 57 50 - # No tests in the pypi archive 51 - doCheck = false; 58 + # No tests in the pypi archive, we add a test to check that all bindings can be imported 59 + checkPhase = '' 60 + runHook preCheck 61 + 62 + cat <<EOF > test-import-bindings.py 63 + import sys 64 + import os 65 + if (cwd := os.getcwd()) in sys.path: 66 + # remove current working directory from sys.path, use PYTHONPATH instead 67 + sys.path.remove(cwd) 68 + 69 + from typing import get_args 70 + from tree_sitter_language_pack import SupportedLanguage, get_binding 71 + 72 + for lang in get_args(SupportedLanguage): 73 + get_binding(lang) 74 + EOF 75 + 76 + ${python.interpreter} test-import-bindings.py 77 + 78 + runHook postCheck 79 + ''; 80 + 81 + passthru.updateScript = nix-update-script { }; 52 82 53 83 meta = { 54 84 description = "Comprehensive collection of tree-sitter languages";