diff mbox series

[bug#69980,13/13] gnu: pre-commit: Update to 3.6.2.

Message ID 923daa675a7cbc414ebc2e4032044ba8b9fb2f37.1711287459.git.monego@posteo.net
State New
Headers show
Series Update and cleanup pre-commit & friends. | expand

Commit Message

Vinicius Monego March 24, 2024, 1:40 p.m. UTC
* gnu/packages/version-control.scm (pre-commit): Update to 3.6.2.
[build-system]: Use pyproject-build-system.
[arguments]: Use G-Expressions. Do not override the check phase, skip the
tests in #:test-flags instead. Don't make source tree writable in the
prepare-check-env phase.
[native-inputs]: Use the new style.

Change-Id: I4a1c56ce0903d6aa185d65d39c03c9566a6cf0d9
---
 gnu/packages/version-control.scm | 106 +++++++++++++------------------
 1 file changed, 43 insertions(+), 63 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 946b1f5aac..1fc3c7274e 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -29,7 +29,7 @@ 
 ;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2020 John D. Boy <jboy@bius.moe>
 ;;; Copyright © 2020, 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
-;;; Copyright © 2020, 2021, 2022, 2023 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020, 2021, 2022, 2023, 2024 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org>
 ;;; Copyright © 2020, 2021, 2022 Michael Rohleder <mike@rohleder.de>
 ;;; Copyright © 2021 Greg Hogan <code@greghogan.com>
@@ -1987,7 +1987,7 @@  (define-public gitile
 (define-public pre-commit
   (package
     (name "pre-commit") ;formerly known as python-pre-commit
-    (version "3.3.3")
+    (version "3.6.2")
     (source
      (origin
        (method git-fetch)               ; no tests in PyPI release
@@ -1996,73 +1996,53 @@  (define-public pre-commit
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1spkg3ld3s6l7wz24lcywlf1z2ywp751bcdlxjfdsln76bi9ylp8"))
+        (base32 "01b8mphyvm961n8hsk4ajqqgm5vwkr2kbi837s231bablnhs8ldf"))
        (modules '((guix build utils)))
        (snippet '(substitute* "setup.cfg"
                    (("virtualenv>=20.10.0") ;our virtualenv (20.3.1) is fine
                     "virtualenv>=20.0.8")))))
-    (build-system python-build-system)
+    (build-system pyproject-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'check 'prepare-check-env
-           (lambda _
-             ;; Change from /homeless-shelter to /tmp for write permission.
-             (setenv "HOME" "/tmp")
-             ;; Environment variables used in the tests.
-             (setenv "GIT_AUTHOR_NAME" "Your Name")
-             (setenv "GIT_COMMITTER_NAME" "Your Name")
-             (setenv "GIT_AUTHOR_EMAIL" "you@example.com")
-             (setenv "GIT_COMMITTER_EMAIL" "you@example.com")
-             ;; Some tests still fail with PermissionError.  Make the source
-             ;; tree writable.
-             (for-each make-file-writable (find-files "."))
-             ;; Some tests will need a working git repository.
-             (invoke "git" "init")
-             (invoke "git" "config" "--global" "user.name" "Your Name")
-             (invoke "git" "config" "--global" "user.email" "you@example.com")))
-         (replace 'check
-           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
-             (add-installed-pythonpath inputs outputs)
-             (when tests?
-               ;; The file below contains 30+ tests that fail because they
-               ;; depend on tools from multiple languages (cargo, npm, cpan,
-               ;; Rscript, etc).  Other tests are passing, but it's more
-               ;; convenient to skip the file than list 30 tests to skip.
-               (invoke "pytest" "--ignore=tests/repository_test.py"
-                       ;; Ruby and Node tests require node and gem.
-                       "--ignore=tests/languages/node_test.py"
-                       "--ignore=tests/languages/ruby_test.py"
-                       ;; Skip lang-specific (network) tests added in 3.1.1
-                       "--ignore=tests/languages/conda_test.py"
-                       "--ignore=tests/languages/coursier_test.py"
-                       "--ignore=tests/languages/dart_test.py"
-                       "--ignore=tests/languages/docker_test.py"
-                       "--ignore=tests/languages/docker_image_test.py"
-                       "--ignore=tests/languages/dotnet_test.py"
-                       "--ignore=tests/languages/golang_test.py"
-                       "--ignore=tests/languages/lua_test.py"
-                       "--ignore=tests/languages/perl_test.py"
-                       "--ignore=tests/languages/rust_test.py"
-                       "--ignore=tests/languages/swift_test.py"
-                       "-k"
-                       (string-append
-                        ;; TODO: these tests fail with AssertionError.  It may
-                        ;; be possible to fix them.
-                        "not test_install_existing_hooks_no_overwrite"
-                        " and not test_uninstall_restores_legacy_hooks"
-                        " and not test_installed_from_venv"
-                        " and not test_healthy_venv_creator"
-                        " and not test_r_hook and not test_r_inline"))))))))
+     (list
+      ;; Skip language-specific tests because they depennd on language tools.
+      #:test-flags
+      #~(list "--ignore" "tests/languages"
+              ;; These fail with AssertionError.
+              "-k" (string-append
+                    "not test_additional_dependencies_roll_forward"
+                    " and not test_control_c_control_c_on_install"
+                    " and not test_invalidated_virtualenv"
+                    " and not test_local_python_repo"
+                    " and not test_install_existing_hooks_no_overwrite"
+                    " and not test_uninstall_restores_legacy_hooks"
+                    " and not test_installed_from_venv"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'check 'prepare-check-env
+            (lambda _
+              ;; Change from /homeless-shelter to /tmp for write permission.
+              (setenv "HOME" "/tmp")
+              ;; Environment variables used in the tests.
+              (setenv "GIT_AUTHOR_NAME" "Your Name")
+              (setenv "GIT_COMMITTER_NAME" "Your Name")
+              (setenv "GIT_AUTHOR_EMAIL" "you@example.com")
+              (setenv "GIT_COMMITTER_EMAIL" "you@example.com")
+              ;; Some tests still fail with PermissionError.  Make the source
+              ;; tree writable.
+              ;; (for-each make-file-writable (find-files "."))
+              ;; Some tests will need a working git repository.
+              (invoke "git" "init")
+              (invoke "git" "config" "--global" "user.name" "Your Name")
+              (invoke "git" "config" "--global" "user.email" "you@example.com"))))))
     (native-inputs
-     `(("git" ,git-minimal)
-       ("python-covdefaults" ,python-covdefaults)
-       ("python-coverage" ,python-coverage)
-       ("python-distlib" ,python-distlib)
-       ("python-pytest" ,python-pytest)
-       ("python-pytest-env" ,python-pytest-env)
-       ("python-re-assert" ,python-re-assert)
-       ("which" ,which)))
+     (list git-minimal
+           python-covdefaults
+           python-coverage
+           python-distlib
+           python-pytest
+           python-pytest-env
+           python-re-assert
+           which))
     ;; Propagate because pre-commit is also used as a module.
     (propagated-inputs
      (list python-cfgv