Merge pull request #332747 from natsukium/dont-propagate-versioned-tree-sitter

python312Packages.tree-sitter_0_21: remove from propagated dependencies
This commit is contained in:
OTABI Tomoya 2024-08-07 20:04:26 +09:00 committed by GitHub
commit b9f2737b66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 35 additions and 41 deletions

View File

@ -5,7 +5,10 @@
}: }:
let let
python3 = python311; python3 = python311.override {
self = python3;
packageOverrides = _: super: { tree-sitter = super.tree-sitter_0_21; };
};
in in
python3.pkgs.buildPythonApplication rec { python3.pkgs.buildPythonApplication rec {
pname = "autotools-language-server"; pname = "autotools-language-server";

View File

@ -1,14 +1,15 @@
{ lib {
, buildPythonPackage lib,
, fetchFromGitHub buildPythonPackage,
, setuptools-generate fetchFromGitHub,
, setuptools-scm setuptools-generate,
, colorama setuptools-scm,
, jinja2 colorama,
, jsonschema jinja2,
, pygls jsonschema,
, tree-sitter0_21 pygls,
, pytestCheckHook tree-sitter,
pytestCheckHook,
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -33,16 +34,9 @@ buildPythonPackage rec {
jinja2 jinja2
jsonschema jsonschema
pygls pygls
# The build won't fail if we had used tree-sitter (version > 0.21), but tree-sitter
# this package is only a dependency of autotools-language-server which also
# depends on tree-sitter-languages which must use tree-sitter0_21 and not
# tree-sitter. Hence we avoid different tree-sitter versions dependency
# mismatch by defaulting here to this lower version.
tree-sitter0_21
];
nativeCheckInputs = [
pytestCheckHook
]; ];
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "lsp_tree_sitter" ]; pythonImportsCheck = [ "lsp_tree_sitter" ];

View File

@ -51,7 +51,8 @@ buildPythonPackage rec {
pytestCheckHook pytestCheckHook
syrupy syrupy
time-machine time-machine
] ++ lib.flatten (builtins.attrValues optional-dependencies); tree-sitter
];
disabledTestPaths = [ disabledTestPaths = [
# Snapshot tests require syrupy<4 # Snapshot tests require syrupy<4

View File

@ -1,12 +1,12 @@
{ lib {
, buildPythonPackage lib,
, fetchFromGitHub buildPythonPackage,
, setuptools fetchFromGitHub,
, wheel setuptools,
, cython cython,
, tree-sitter0_21 tree-sitter,
, pytestCheckHook pytestCheckHook,
, python python,
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -34,20 +34,14 @@ buildPythonPackage rec {
build-system = [ build-system = [
setuptools setuptools
wheel
cython cython
]; ];
dependencies = [ dependencies = [ tree-sitter ];
# https://github.com/grantjenks/py-tree-sitter-languages/issues/67
tree-sitter0_21
];
# Generate languages.so file (build won't fail without this, but tests will). # Generate languages.so file (build won't fail without this, but tests will).
preBuild = '' preBuild = ''
${python.pythonOnBuildForHost.interpreter} build.py ${python.pythonOnBuildForHost.interpreter} build.py
''; '';
nativeCheckInputs = [ nativeCheckInputs = [ pytestCheckHook ];
pytestCheckHook
];
# Without cd $out, tests fail to import the compiled cython extensions. # Without cd $out, tests fail to import the compiled cython extensions.
# Without copying the ./tests/ directory to $out, pytest won't detect the # Without copying the ./tests/ directory to $out, pytest won't detect the
# tests and run them. See also: # tests and run them. See also:
@ -64,5 +58,7 @@ buildPythonPackage rec {
homepage = "https://github.com/grantjenks/py-tree-sitter-languages"; homepage = "https://github.com/grantjenks/py-tree-sitter-languages";
license = licenses.asl20; license = licenses.asl20;
maintainers = with maintainers; [ doronbehar ]; maintainers = with maintainers; [ doronbehar ];
# https://github.com/grantjenks/py-tree-sitter-languages/issues/67
broken = versionAtLeast tree-sitter.version "0.22";
}; };
} }

View File

@ -10,7 +10,7 @@
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "tree-sitter0_21"; pname = "tree-sitter";
version = "0.21.3"; version = "0.21.3";
pyproject = true; pyproject = true;

View File

@ -15814,7 +15814,7 @@ self: super: with self; {
tree-sitter = callPackage ../development/python-modules/tree-sitter { }; tree-sitter = callPackage ../development/python-modules/tree-sitter { };
tree-sitter0_21 = callPackage ../development/python-modules/tree-sitter0_21 { }; tree-sitter_0_21 = callPackage ../development/python-modules/tree-sitter/0_21.nix { };
tree-sitter-html = callPackage ../development/python-modules/tree-sitter-html { }; tree-sitter-html = callPackage ../development/python-modules/tree-sitter-html { };