~ruther/guix-local

fd0e15e5510577233e5925f555c45d182b4c7c22 — Efraim Flashner 1 year, 9 months ago c052598
gnu: python-libcst: Update to 1.6.0.

* gnu/packages/python-xyz.scm (python-libcst): Update to 1.6.0.
[source]: Add snippet to satisfy cargo-build-system.
[build-system]: Switch to cargo-build-system.
[arguments]: Import cargo-build-system, pyproject-build-system modules.
Add cargo-inputs, cargo-development-inputs.  Replace 'build, 'install
with the pyproject-build-system phases.  Add a phase after 'install for
the extra pyproject phases.  Add 2 phases to help build the project.
[native-inputs]: Add python-minimal-wrapper, python-hypothesmith,
python-setuptools-rust, python-setuptools-scm.
[inputs]: Add maturin.
[propagated-inputs]: Remove python-typing-extensions,
python-typing-inspect.
(python-libcst-minimal)[arguments]: Inherit phases from python-libcst
while still skipping the tests.
[native-inputs]: Add python-minimal-wrapper, python-setutools-rust,
python-setuptools-scm.

Change-Id: I7b5ba5404f6e726976af25c0f7db7db2d00bedc5
1 files changed, 86 insertions(+), 25 deletions(-)

M gnu/packages/python-xyz.scm
M gnu/packages/python-xyz.scm => gnu/packages/python-xyz.scm +86 -25
@@ 198,6 198,7 @@
  #:use-module (gnu packages cmake)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages cpp)
  #:use-module (gnu packages crates-check)
  #:use-module (gnu packages crates-io)
  #:use-module (gnu packages crates-windows)
  #:use-module (gnu packages crypto)


@@ 23123,40 23124,95 @@ some degree most natural languages too.")
(define-public python-libcst
  (package
    (name "python-libcst")
    (version "0.3.18") ; starting from 0.4.0 project depends on Rust
    (version "1.6.0")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "libcst" version))
              (sha256
               (base32
                "1ll0yyxbz8zyqcy9kfcqi3l5fah2zqisvpjbzjnz7s7dmb84q59h"))))
    (build-system pyproject-build-system)
                "1nzhvg52whpmfv8fkrnv7rlrmgc5m43hpyp8ra9kffx47yzcs3p8"))
              (snippet
               #~(begin (use-modules (guix build utils))
                        ;; This is mostly to keep the cargo-build-system happy
                        (with-output-to-file "Cargo.toml"
                          (lambda ()
                            (format #t "\
[workspace]

members = [
    \"native\",]")))))))
    (build-system cargo-build-system)
    (arguments
     (list
      #:test-flags
      #~(list
         ;; Reported upstream: <https://github.com/Instagram/LibCST/issues/346>.
         "--ignore=libcst/tests/test_fuzz.py"
         ;; Reported upstream: <https://github.com/Instagram/LibCST/issues/347>.
         "--ignore=libcst/tests/test_pyre_integration.py"
         "--ignore=libcst/codemod/tests/test_codemod_cli.py"
         "--ignore=libcst/metadata/tests/test_full_repo_manager.py"
         "--ignore=libcst/metadata/tests/test_type_inference_provider.py"
         "-k" (string-join
               ;; AssertionError: False is not true : libcst.matchers.__init__
               ;; needs new codegen!
               (list "not test_codegen_clean_matcher_classes"
                     "test_codegen_clean_return_types"
                     "test_codegen_clean_visitor_functions")
               " and not "))))
      #:install-source? #false
      #:cargo-test-flags
      ;; According to .github/workflows/ci.yml
      '(list "--manifest-path=native/Cargo.toml"
             "--release"
             "--no-default-features")
      #:cargo-inputs
      (list rust-chic-1
            rust-memchr-2
            rust-paste-1
            rust-peg-0.8
            rust-pyo3-0.22
            rust-quote-1
            rust-regex-1
            rust-syn-2
            rust-thiserror-1)
      #:cargo-development-inputs
      (list rust-criterion-0.5
            rust-difference-2
            rust-itertools-0.13
            rust-rayon-1
            rust-trybuild-1)
      #:imported-modules `(,@%pyproject-build-system-modules
                           ,@%cargo-build-system-modules)
      #:modules `((guix build cargo-build-system)
                  ((guix build pyproject-build-system) #:prefix py:)
                  (guix build utils))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'prepare-source
            (lambda _
              (delete-file "native/Cargo.lock")))
          (add-after 'configure 'dont-vendor-self
            (lambda* (#:key vendor-dir #:allow-other-keys)
              ;; Don't keep the whole tarball in the vendor directory
              (delete-file-recursively
                (string-append vendor-dir "/libcst-" #$version ".tar.zst"))))
          (replace 'build
            (assoc-ref py:%standard-phases 'build))
          (add-after 'install 'wrap
            (lambda _
              ;; Collection of python- and pyproject-build-system phases
              ;; between 'install and 'check.
              (assoc-ref py:%standard-phases 'add-install-to-pythonpath)
              (assoc-ref py:%standard-phases 'add-install-to-path)
              (assoc-ref py:%standard-phases 'wrap)
              (assoc-ref py:%standard-phases 'create-entrypoints)
              (assoc-ref py:%standard-phases 'compile-bytecode)))
          ;; We are not the only ones who cannot load libcst.native
          ;; during the 'check phase
          ;; https://github.com/Instagram/LibCST/issues/1176
          ;(add-after 'wrap 'python-check
          ;  (lambda args
          ;    (apply (assoc-ref py:%standard-phases 'check)
          ;           #:test-flags '()
          ;           args)))
          (replace 'install
            (assoc-ref py:%standard-phases 'install)))))
    (native-inputs
     (list python-pytest
     (list python-minimal-wrapper
           python-hypothesmith
           python-pytest
           python-setuptools
           python-setuptools-rust
           python-setuptools-scm
           python-wheel))
    (inputs (list maturin))
    (propagated-inputs
     (list python-typing-extensions
           python-typing-inspect
           python-pyyaml))
     (list python-pyyaml))
    (home-page "https://github.com/Instagram/LibCST")
    (synopsis "Concrete Syntax Tree (CST) parser and serializer library for Python")
    (description


@@ 23179,9 23235,14 @@ feels like an AST.")
   (package
     (inherit python-libcst)
     (name "python-libcst-minimal")
     (arguments '(#:tests? #f))
     (arguments
      (substitute-keyword-arguments (package-arguments python-libcst)
        ((#:tests? _ #t) #f)))
    (native-inputs
     (list python-setuptools
     (list python-minimal-wrapper
           python-setuptools
           python-setuptools-rust
           python-setuptools-scm
           python-wheel)))))

(define-public python-typeapi