Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 04/30] dev-python/isort: Switch to PEP 517 build
Date: Sun, 06 Feb 2022 12:50:31
Message-Id: 20220206124841.1299133-5-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 00/30] One batch of Python eclass updates to rule them all by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 dev-python/isort/isort-5.10.1-r1.ebuild | 65 +++++++++++++++++++++++++
4 1 file changed, 65 insertions(+)
5 create mode 100644 dev-python/isort/isort-5.10.1-r1.ebuild
6
7 diff --git a/dev-python/isort/isort-5.10.1-r1.ebuild b/dev-python/isort/isort-5.10.1-r1.ebuild
8 new file mode 100644
9 index 000000000000..11d6b04236b8
10 --- /dev/null
11 +++ b/dev-python/isort/isort-5.10.1-r1.ebuild
12 @@ -0,0 +1,65 @@
13 +# Copyright 1999-2022 Gentoo Authors
14 +# Distributed under the terms of the GNU General Public License v2
15 +
16 +EAPI=8
17 +
18 +DISTUTILS_USE_PEP517=poetry
19 +PYTHON_COMPAT=( python3_{8..10} )
20 +
21 +inherit distutils-r1
22 +
23 +DESCRIPTION="A python utility/library to sort imports"
24 +HOMEPAGE="https://pypi.org/project/isort/"
25 +SRC_URI="
26 + https://github.com/PyCQA/isort/archive/${PV}.tar.gz
27 + -> ${P}.gh.tar.gz"
28 +
29 +LICENSE="MIT"
30 +SLOT="0"
31 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
32 +
33 +RDEPEND="
34 + dev-python/toml[${PYTHON_USEDEP}]"
35 +BDEPEND="
36 + test? (
37 + dev-python/black[${PYTHON_USEDEP}]
38 + dev-python/colorama[${PYTHON_USEDEP}]
39 + dev-python/hypothesis[${PYTHON_USEDEP}]
40 + dev-python/natsort[${PYTHON_USEDEP}]
41 + dev-python/pylama[${PYTHON_USEDEP}]
42 + dev-python/pytest-mock[${PYTHON_USEDEP}]
43 + dev-vcs/git
44 + )
45 +"
46 +
47 +distutils_enable_tests pytest
48 +
49 +src_prepare() {
50 + # unbundle toml
51 + sed -i -e 's:from ._vendored ::' isort/settings.py || die
52 + rm -r isort/_vendored || die
53 + # remove upper bounds from example plugin deps
54 + # (already removed upstream)
55 + sed -i -e 's:\^:>=:' example*/pyproject.toml || die
56 +
57 + distutils-r1_src_prepare
58 +}
59 +
60 +python_test() {
61 + cp -a "${BUILD_DIR}"/{install,test} || die
62 + local -x PATH=${BUILD_DIR}/test/usr/bin:${PATH}
63 +
64 + # Install necessary plugins
65 + local p
66 + for p in example*/; do
67 + pushd "${p}" >/dev/null || die
68 + distutils_pep517_install "${BUILD_DIR}"/test
69 + popd >/dev/null || die
70 + done
71 +
72 + local EPYTEST_IGNORE=(
73 + # Excluded from upstream's test script
74 + tests/unit/test_deprecated_finders.py
75 + )
76 + epytest tests/unit
77 +}
78 --
79 2.35.1