Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-vcs/pre-commit/
Date: Fri, 16 Apr 2021 15:35:28
Message-Id: 1618587315.cfc5aaf1ec3029a7aeb0401b5180619a6201e782.marecki@gentoo
1 commit: cfc5aaf1ec3029a7aeb0401b5180619a6201e782
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 16 15:25:14 2021 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 16 15:35:15 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cfc5aaf1
7
8 dev-vcs/pre-commit: new package
9
10 With tests regrettably restricted for now - although their vast majority
11 (excluding the language/repository ones, which have a lot of
12 dependencies and do not always handle their absence correctly) passes,
13 there are 9 which fail due to unspecified problems invoking git.
14
15 Closes: https://bugs.gentoo.org/679014
16 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
17
18 dev-vcs/pre-commit/Manifest | 1 +
19 dev-vcs/pre-commit/metadata.xml | 12 ++++++
20 dev-vcs/pre-commit/pre-commit-2.12.0.ebuild | 67 +++++++++++++++++++++++++++++
21 3 files changed, 80 insertions(+)
22
23 diff --git a/dev-vcs/pre-commit/Manifest b/dev-vcs/pre-commit/Manifest
24 new file mode 100644
25 index 00000000000..38fb887c07e
26 --- /dev/null
27 +++ b/dev-vcs/pre-commit/Manifest
28 @@ -0,0 +1 @@
29 +DIST pre-commit-2.12.0.tar.gz 246269 BLAKE2B a697cc0287e0cd5698d78056cd51484115788fc22ab36d951e3f390efad881353ed10a39f04fbfda78c163f2eb67357d6b0050d2a34d79fcb4c3495b9eab6046 SHA512 b65dab5dade2186785b2065d9d73427836a61acc3b2efcf54e74313361dcdb89c7ec829a1f653a4491afbe78d11cd4ed640ca579e7d2ca383daeb9680867812d
30
31 diff --git a/dev-vcs/pre-commit/metadata.xml b/dev-vcs/pre-commit/metadata.xml
32 new file mode 100644
33 index 00000000000..cf8278c8169
34 --- /dev/null
35 +++ b/dev-vcs/pre-commit/metadata.xml
36 @@ -0,0 +1,12 @@
37 +<?xml version="1.0" encoding="UTF-8"?>
38 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
39 +<pkgmetadata>
40 + <maintainer type="person">
41 + <email>marecki@g.o</email>
42 + <name>Marek Szuba</name>
43 + </maintainer>
44 + <upstream>
45 + <remote-id type="github">pre-commit/pre-commit</remote-id>
46 + <remote-id type="pypi">pre-commit</remote-id>
47 + </upstream>
48 +</pkgmetadata>
49
50 diff --git a/dev-vcs/pre-commit/pre-commit-2.12.0.ebuild b/dev-vcs/pre-commit/pre-commit-2.12.0.ebuild
51 new file mode 100644
52 index 00000000000..8dc97acfe00
53 --- /dev/null
54 +++ b/dev-vcs/pre-commit/pre-commit-2.12.0.ebuild
55 @@ -0,0 +1,67 @@
56 +# Copyright 1999-2021 Gentoo Authors
57 +# Distributed under the terms of the GNU General Public License v2
58 +
59 +EAPI=7
60 +
61 +PYTHON_COMPAT=( python3_{8..9} )
62 +DISTUTILS_SINGLE_IMPL=1
63 +DISTUTILS_USE_SETUPTOOLS=rdepend
64 +PYTHON_REQ_USE="sqlite"
65 +
66 +inherit distutils-r1
67 +
68 +DESCRIPTION="A framework for managing and maintaining multi-language Git pre-commit hooks"
69 +HOMEPAGE="https://pre-commit.com/"
70 +SRC_URI="https://github.com/${PN}/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
71 +
72 +LICENSE="MIT"
73 +SLOT="0"
74 +KEYWORDS="~amd64"
75 +
76 +# TODO: figure out why these tests - all of which invoke git - fail:
77 +# - tests/main_test.py::test_all_cmds[autoupdate,hook-impl,install,install-hooks,migrate-config,run,uninstall]
78 +# "Git failed", not much information beyond that
79 +# - tests/main_test.py::test_try_repo
80 +# Ditto
81 +# - tests/commands/install_uninstall_test.py::test_installed_from_venv
82 +# "git commit" returns 1 instead of 0, again no details
83 +# even with the environment variables normally handled by pytest-env (which we haven't got in the tree yet)
84 +# explicitly declared in python_test().
85 +#RESTRICT="test"
86 +
87 +RDEPEND="dev-vcs/git
88 + $(python_gen_cond_dep '
89 + dev-python/cfgv[${PYTHON_USEDEP}]
90 + dev-python/identify[${PYTHON_USEDEP}]
91 + dev-python/nodeenv[${PYTHON_USEDEP}]
92 + dev-python/pyyaml[${PYTHON_USEDEP}]
93 + dev-python/toml[${PYTHON_USEDEP}]
94 + >=dev-python/virtualenv-20.0.8[${PYTHON_USEDEP}]
95 + ')"
96 +BDEPEND="test? (
97 + $(python_gen_cond_dep 'dev-python/re-assert[${PYTHON_USEDEP}]')
98 +)"
99 +
100 +DOCS=( CHANGELOG.md CONTRIBUTING.md README.md )
101 +
102 +distutils_enable_tests --install pytest
103 +
104 +src_prepare() {
105 + default
106 +
107 + # These tests require a boatload of dependencies (e.g. Conda, Go, R and more) in order to run
108 + # and while some of them do include "skip if not found" logic, most of them do not.
109 + rm -rf tests/languages tests/repository_test.py
110 +}
111 +
112 +python_test() {
113 + # TODO: add pytest-env to the tree so that these can be read from tox.ini
114 + declare -x GIT_AUTHOR_NAME=test
115 + declare -x GIT_COMMITTER_NAME=test
116 + declare -x GIT_AUTHOR_EMAIL=test@×××××××.com
117 + declare -x GIT_COMMITTER_EMAIL=test@×××××××.com
118 + declare -x VIRTUALENV_NO_DOWNLOAD=1
119 + declare -x PRE_COMMIT_NO_CONCURRENCY=1
120 +
121 + distutils-r1_python_test
122 +}