gnu: pre-commit: Update to 3.7.1.

* gnu/packages/version-control.scm (pre-commit): Update to 3.7.1.
[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
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Vinicius Monego 2024-06-01 16:58:00 +02:00 committed by Sharlatan Hellseher
parent cb6fec876a
commit e715096f0e
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -2247,7 +2247,7 @@ visualize your public Git repositories on a web interface.")
(define-public pre-commit (define-public pre-commit
(package (package
(name "pre-commit") ;formerly known as python-pre-commit (name "pre-commit") ;formerly known as python-pre-commit
(version "3.3.3") (version "3.7.1")
(source (source
(origin (origin
(method git-fetch) ; no tests in PyPI release (method git-fetch) ; no tests in PyPI release
@ -2256,15 +2256,28 @@ visualize your public Git repositories on a web interface.")
(commit (string-append "v" version)))) (commit (string-append "v" version))))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 "1spkg3ld3s6l7wz24lcywlf1z2ywp751bcdlxjfdsln76bi9ylp8")) (base32 "1m2cs21xq2j1x80s7bh47fm2nsbnfxgscxfijaqwdsi2rrf4vlzv"))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet '(substitute* "setup.cfg" (snippet '(substitute* "setup.cfg"
(("virtualenv>=20.10.0") ;our virtualenv (20.3.1) is fine (("virtualenv>=20.10.0") ;our virtualenv (20.3.1) is fine
"virtualenv>=20.0.8"))))) "virtualenv>=20.0.8")))))
(build-system python-build-system) (build-system pyproject-build-system)
(arguments (arguments
`(#:phases (list
(modify-phases %standard-phases ;; 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 (add-before 'check 'prepare-check-env
(lambda _ (lambda _
;; Change from /homeless-shelter to /tmp for write permission. ;; Change from /homeless-shelter to /tmp for write permission.
@ -2276,44 +2289,11 @@ visualize your public Git repositories on a web interface.")
(setenv "GIT_COMMITTER_EMAIL" "you@example.com") (setenv "GIT_COMMITTER_EMAIL" "you@example.com")
;; Some tests still fail with PermissionError. Make the source ;; Some tests still fail with PermissionError. Make the source
;; tree writable. ;; tree writable.
(for-each make-file-writable (find-files ".")) ;; (for-each make-file-writable (find-files "."))
;; Some tests will need a working git repository. ;; Some tests will need a working git repository.
(invoke "git" "init") (invoke "git" "init")
(invoke "git" "config" "--global" "user.name" "Your Name") (invoke "git" "config" "--global" "user.name" "Your Name")
(invoke "git" "config" "--global" "user.email" "you@example.com"))) (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"))))))))
(native-inputs (native-inputs
(list git-minimal (list git-minimal
python-covdefaults python-covdefaults