commit:     cfc5aaf1ec3029a7aeb0401b5180619a6201e782
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 16 15:25:14 2021 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Fri Apr 16 15:35:15 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cfc5aaf1

dev-vcs/pre-commit: new package

With tests regrettably restricted for now - although their vast majority
(excluding the language/repository ones, which have a lot of
dependencies and do not always handle their absence correctly) passes,
there are 9 which fail due to unspecified problems invoking git.

Closes: https://bugs.gentoo.org/679014
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 dev-vcs/pre-commit/Manifest                 |  1 +
 dev-vcs/pre-commit/metadata.xml             | 12 ++++++
 dev-vcs/pre-commit/pre-commit-2.12.0.ebuild | 67 +++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+)

diff --git a/dev-vcs/pre-commit/Manifest b/dev-vcs/pre-commit/Manifest
new file mode 100644
index 00000000000..38fb887c07e
--- /dev/null
+++ b/dev-vcs/pre-commit/Manifest
@@ -0,0 +1 @@
+DIST pre-commit-2.12.0.tar.gz 246269 BLAKE2B 
a697cc0287e0cd5698d78056cd51484115788fc22ab36d951e3f390efad881353ed10a39f04fbfda78c163f2eb67357d6b0050d2a34d79fcb4c3495b9eab6046
 SHA512 
b65dab5dade2186785b2065d9d73427836a61acc3b2efcf54e74313361dcdb89c7ec829a1f653a4491afbe78d11cd4ed640ca579e7d2ca383daeb9680867812d

diff --git a/dev-vcs/pre-commit/metadata.xml b/dev-vcs/pre-commit/metadata.xml
new file mode 100644
index 00000000000..cf8278c8169
--- /dev/null
+++ b/dev-vcs/pre-commit/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Marek Szuba</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">pre-commit/pre-commit</remote-id>
+               <remote-id type="pypi">pre-commit</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/dev-vcs/pre-commit/pre-commit-2.12.0.ebuild 
b/dev-vcs/pre-commit/pre-commit-2.12.0.ebuild
new file mode 100644
index 00000000000..8dc97acfe00
--- /dev/null
+++ b/dev-vcs/pre-commit/pre-commit-2.12.0.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{8..9} )
+DISTUTILS_SINGLE_IMPL=1
+DISTUTILS_USE_SETUPTOOLS=rdepend
+PYTHON_REQ_USE="sqlite"
+
+inherit distutils-r1
+
+DESCRIPTION="A framework for managing and maintaining multi-language Git 
pre-commit hooks"
+HOMEPAGE="https://pre-commit.com/";
+SRC_URI="https://github.com/${PN}/${PN}/archive/refs/tags/v${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+# TODO: figure out why these tests - all of which invoke git - fail:
+#  - 
tests/main_test.py::test_all_cmds[autoupdate,hook-impl,install,install-hooks,migrate-config,run,uninstall]
+#     "Git failed", not much information beyond that
+#  - tests/main_test.py::test_try_repo
+#     Ditto
+#  - tests/commands/install_uninstall_test.py::test_installed_from_venv
+#     "git commit" returns 1 instead of 0, again no details
+# even with the environment variables normally handled by pytest-env (which we 
haven't got in the tree yet)
+# explicitly declared in python_test().
+#RESTRICT="test"
+
+RDEPEND="dev-vcs/git
+       $(python_gen_cond_dep '
+               dev-python/cfgv[${PYTHON_USEDEP}]
+               dev-python/identify[${PYTHON_USEDEP}]
+               dev-python/nodeenv[${PYTHON_USEDEP}]
+               dev-python/pyyaml[${PYTHON_USEDEP}]
+               dev-python/toml[${PYTHON_USEDEP}]
+               >=dev-python/virtualenv-20.0.8[${PYTHON_USEDEP}]
+       ')"
+BDEPEND="test? (
+       $(python_gen_cond_dep 'dev-python/re-assert[${PYTHON_USEDEP}]')
+)"
+
+DOCS=( CHANGELOG.md CONTRIBUTING.md README.md )
+
+distutils_enable_tests --install pytest
+
+src_prepare() {
+       default
+
+       # These tests require a boatload of dependencies (e.g. Conda, Go, R and 
more) in order to run
+       # and while some of them do include "skip if not found" logic, most of 
them do not.
+       rm -rf tests/languages tests/repository_test.py
+}
+
+python_test() {
+       # TODO: add pytest-env to the tree so that these can be read from 
tox.ini
+       declare -x GIT_AUTHOR_NAME=test
+       declare -x GIT_COMMITTER_NAME=test
+       declare -x [email protected]
+       declare -x [email protected]
+       declare -x VIRTUALENV_NO_DOWNLOAD=1
+       declare -x PRE_COMMIT_NO_CONCURRENCY=1
+
+       distutils-r1_python_test
+}

Reply via email to