~ruther/guix-local

10acea6c9d58e48c0513a4765426e2e289b81c3e — Evgenii Klimov 1 year, 1 month ago 15293e0
gnu: python-tree-sitter: Update to 0.25.2.

- Remove set-test-lib-paths phase, due to the upstream change in how grammars
  are loaded.  Previosly, one had to provide path to the grammar file, now each
  grammar is built in it's own package.
- In native-inputs, replace tree-sitter grammars with python bindings for
  these grammars.

* gnu/packages/tree-sitter.scm (python-tree-sitter): Update to 0.25.2.

Change-Id: I2ba183ab2a32c473f4e2bc0e616946193df850d7
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
1 files changed, 9 insertions(+), 34 deletions(-)

M gnu/packages/tree-sitter.scm
M gnu/packages/tree-sitter.scm => gnu/packages/tree-sitter.scm +9 -34
@@ 1562,7 1562,7 @@ files.")))
(define-public python-tree-sitter
  (package
    (name "python-tree-sitter")
    (version "0.21.3")
    (version "0.25.2")
    (source
     (origin
       (method git-fetch)


@@ 1571,7 1571,7 @@ files.")))
              (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1cdxl0zyldml3x5wi2nmlmhwfahwxalcr5lxyb6j6762irmm4b2c"))))
        (base32 "15j6gxc6ps6zdrmqfmmz22p7p5gz37cyihzzwbjggy7mc4vwm5fj"))))
    (build-system pyproject-build-system)
    (arguments
     (list


@@ 1589,44 1589,19 @@ files.")))
                    tabs "libraries=[\"tree-sitter\"],\n"
                    all))
                  (("include_dirs=\\[" all)
                   (string-append all "\"" tree-sitter "/include\""))))))
          (add-before 'check 'set-test-lib-paths
            (lambda* (#:key native-inputs inputs #:allow-other-keys)
              (substitute* "tests/test_tree_sitter.py"
                (("Language\\.build_library")
                 "_ =")
                (((string-append "LIB_PATH, \"("
                                 (string-join
                                  '("embedded_template"
                                    "html"
                                    "javascript"
                                    "json"
                                    "python"
                                    "rust")
                                  "|")
                                 ")\"")
                  all name)
                 (string-append
                  (format #f "~s, ~s"
                          (search-input-file
                           (or native-inputs inputs)
                           (string-append
                            "lib/tree-sitter/libtree-sitter-" name ".so"))
                          name))))))
                   (string-append all "\"" tree-sitter "/include\","))))))
          ;; XXX: See https://codeberg.org/guix/guix/issues/2108
          (add-before 'check 'remove-uninstalled-package
            (lambda _
              (delete-file-recursively "tree_sitter"))))))
    (inputs (list tree-sitter))
    (native-inputs
     (list tree-sitter-embedded-template
           tree-sitter-html
           tree-sitter-javascript
           tree-sitter-json
           tree-sitter-python
           tree-sitter-rust
           python-setuptools
           python-wheel))
     (list python-setuptools
           (python-tree-sitter-grammar tree-sitter-html #:tests? #f)
           (python-tree-sitter-grammar tree-sitter-javascript #:tests? #f)
           (python-tree-sitter-grammar tree-sitter-json #:tests? #f)
           (python-tree-sitter-grammar tree-sitter-python #:tests? #f)
           (python-tree-sitter-grammar tree-sitter-rust #:tests? #f)))
    (home-page "https://github.com/tree-sitter/py-tree-sitter")
    (synopsis "Python bindings to the Tree-sitter parsing library")
    (description "This package provides Python bindings to the