From: Vinicius Monego <monego@posteo.net>
To: 42082@debbugs.gnu.org
Cc: Vinicius Monego <monego@posteo.net>
Subject: [bug#42082] [PATCH v2 6/6] gnu: Add python-pre-commit.
Date: Fri, 24 Jul 2020 09:01:44 -0300 [thread overview]
Message-ID: <20200724120144.500-6-monego@posteo.net> (raw)
In-Reply-To: <20200724120144.500-1-monego@posteo.net>
* gnu/packages/version-control.scm (pre-commit): New variable.
---
Enable tests. Update to 2.6.0.
Language tests require interpreters/compilers and build systems as inputs
and downloading packages online (e.g. 'go get'), hence disabled.
gnu/packages/version-control.scm | 113 +++++++++++++++++++++++++++++++
1 file changed, 113 insertions(+)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 5151e63ee1..d36b7c013e 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -29,6 +29,7 @@
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2020 John D. Boy <jboy@bius.moe>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1418,6 +1419,118 @@ also walk each side of a merge and test those changes individually.")
control to Git repositories.")
(license license:gpl2)))
+(define-public pre-commit
+ (package
+ (name "pre-commit")
+ (version "2.6.0")
+ (source
+ (origin
+ ;; No tests in the PyPI tarball.
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/pre-commit/pre-commit")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "144hcnz8vz07nkx7hk8a3ac822186ardwxa8jnl6s8qvm5ip92f2"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'check 'set-up-git
+ (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")
+ (invoke "git" "config" "--global" "user.name" "Your Name")
+ (invoke "git" "config" "--global" "user.email" "you@example.com")
+ #t))
+ (replace 'check
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (add-installed-pythonpath inputs outputs)
+ (invoke "pytest" "tests" "-k"
+ (string-append
+ ;; Disable conda tests.
+ "not test_conda_hook"
+ " and not test_conda_with_additional_dependencies_hook"
+ " and not test_local_conda_additional_dependencies"
+ ;; Disable cpan tests.
+ " and not test_local_perl_additional_dependencies"
+ " and not test_perl_hook"
+ ;; Disable Ruby tests.
+ " and not test_additional_ruby_dependencies_installed"
+ " and not test_install_rbenv"
+ " and not test_install_rbenv_with_version"
+ " and not test_run_a_ruby_hook"
+ " and not test_run_ruby_hook_with_disable_shared_gems"
+ " and not test_run_versioned_ruby_hook"
+ ;; Disable Cargo tests
+ " and not test_additional_rust_cli_dependencies_installed"
+ " and not test_additional_rust_lib_dependencies_installed"
+ " and not test_local_rust_additional_dependencies"
+ " and not test_rust_hook"
+ ;; Disable python2 test.
+ " and not test_switch_language_versions_doesnt_clobber"
+ ;; These tests try to open a network socket.
+ " and not test_additional_golang_dependencies_installed"
+ " and not test_additional_node_dependencies_installed"
+ " and not test_golang_hook"
+ " and not test_golang_hook_still_works_when_gobin_is_set"
+ " and not test_local_golang_additional_dependencies"
+ " and not test_main"
+ " and not test_node_hook_with_npm_userconfig_set"
+ " and not test_run_a_node_hook"
+ " and not test_run_versioned_node_hook"
+ ;; Tests failing with a permission error.
+ ;; They try to write to the filesystem.
+ " and not test_autoupdate_hook_disappearing_repo"
+ " and not test_hook_disppearing_repo_raises"
+ " and not test_img_conflict"
+ " and not test_img_something_unstaged"
+ " and not test_installed_from_venv"
+ " and not test_too_new_version"
+ " and not test_try_repo_uncommitted_changes"
+ " and not test_versions_ok"
+ ;; This test tries to activate a virtualenv
+ " and not test_healthy_venv_creator"
+ ;; Fatal error: Not a Git repository.
+ " and not test_all_cmds"
+ " and not test_try_repo"
+ ;; No module named 'pip._internal.cli.main'
+ " and not test_additional_dependencies_roll_forward"
+ ; Assertion errors
+ " and not test_install_existing_hooks_no_overwrite"
+ " and not test_uninstall_restores_legacy_hooks"))))
+ (add-before 'reset-gzip-timestamps 'make-files-writable
+ (lambda* (#:key outputs #:allow-other-keys)
+ ;; Make sure .gz files are writable so that the
+ ;; 'reset-gzip-timestamps' phase can do its work.
+ (let ((out (assoc-ref outputs "out")))
+ (for-each make-file-writable
+ (find-files out "\\.gz$"))
+ #t))))))
+ (native-inputs
+ `(("git" ,git)
+ ("python-pytest" ,python-pytest)))
+ (inputs
+ `(("python-cfgv" ,python-cfgv)
+ ("python-identify" ,python-identify)
+ ("python-nodeenv" ,python-nodeenv)
+ ("python-pyyaml" ,python-pyyaml)
+ ("python-toml" ,python-toml)
+ ("python-virtualenv" ,python-virtualenv)))
+ (home-page "https://pre-commit.com/")
+ (synopsis "Framework for managing and maintaining multi-language pre-commit hooks")
+ (description
+ "Pre-commit is a multi-language package manager for pre-commit hooks. You
+specify a list of hooks you want and pre-commit manages the installation and
+execution of any hook written in any language before every commit.")
+ (license license:expat)))
+
(define (mercurial-patch name revision hash)
(origin
(method url-fetch)
--
2.20.1
next prev parent reply other threads:[~2020-07-24 12:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-27 15:46 [bug#42082] [PATCH 1/6] gnu: Add python-covdefaults Vinicius Monego
2020-06-27 15:46 ` [bug#42083] [PATCH 2/6] gnu: Add python-cfgv Vinicius Monego
2020-07-20 21:17 ` Marius Bakke
2020-06-27 15:46 ` [bug#42084] [PATCH 3/6] gnu: Add python-identify Vinicius Monego
2020-07-20 21:17 ` Marius Bakke
2020-06-27 15:46 ` [bug#42085] [PATCH 4/6] gnu: Add python-nodeenv Vinicius Monego
2020-07-20 21:25 ` Marius Bakke
2020-07-21 18:42 ` Vinicius Monego
2020-06-27 15:46 ` [bug#42086] [PATCH 5/6] gnu: Add python-pytest-env Vinicius Monego
2020-07-20 21:27 ` Marius Bakke
2020-06-27 15:46 ` [bug#42087] [PATCH 6/6] gnu: Add python-pre-commit Vinicius Monego
2020-07-20 21:36 ` Marius Bakke
2020-07-21 18:57 ` Vinicius Monego
2020-07-20 21:13 ` [bug#42082] [PATCH 1/6] gnu: Add python-covdefaults Marius Bakke
2020-07-21 18:28 ` Vinicius Monego
2020-07-21 21:48 ` Marius Bakke
2020-07-24 12:01 ` [bug#42082] [PATCH v2 " Vinicius Monego
2020-07-24 12:01 ` [bug#42082] [PATCH v2 2/6] gnu: Add python-cfgv Vinicius Monego
2020-07-24 12:01 ` [bug#42082] [PATCH v2 3/6] gnu: Add python-identify Vinicius Monego
2020-07-25 16:33 ` Marius Bakke
2020-07-24 12:01 ` [bug#42082] [PATCH v2 4/6] gnu: Add python-nodeenv Vinicius Monego
2020-07-24 12:01 ` [bug#42082] [PATCH v2 5/6] gnu: Add python-pytest-env Vinicius Monego
2020-07-24 12:01 ` Vinicius Monego [this message]
2020-07-25 16:38 ` bug#42082: [PATCH v2 6/6] gnu: Add python-pre-commit Marius Bakke
2020-07-25 2:21 ` [bug#42082] [PATCH 1/6] gnu: Add python-covdefaults Brett Gilio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200724120144.500-6-monego@posteo.net \
--to=monego@posteo.net \
--cc=42082@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).