Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/nose/
Date: Sat, 16 Nov 2019 08:45:52
Message-Id: 1573893941.ca37d7c0b4d5702f5c1fa92206fa5af1a850f1c4.mgorny@gentoo
1 commit: ca37d7c0b4d5702f5c1fa92206fa5af1a850f1c4
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Nov 16 08:13:18 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 16 08:45:41 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ca37d7c0
7
8 dev-python/nose: Make coverage optional, EAPI 7
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/nose/metadata.xml | 4 ++
13 dev-python/nose/nose-1.3.7-r4.ebuild | 98 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 102 insertions(+)
15
16 diff --git a/dev-python/nose/metadata.xml b/dev-python/nose/metadata.xml
17 index 13648a4f19f..a92a97fc50d 100644
18 --- a/dev-python/nose/metadata.xml
19 +++ b/dev-python/nose/metadata.xml
20 @@ -9,4 +9,8 @@
21 <remote-id type="pypi">nose</remote-id>
22 <remote-id type="github">nose-devs/nose</remote-id>
23 </upstream>
24 + <use>
25 + <flag name="coverage">Pull in <pkg>dev-python/coverage</pkg> needed
26 + for nose-xcover plugin.</flag>
27 + </use>
28 </pkgmetadata>
29
30 diff --git a/dev-python/nose/nose-1.3.7-r4.ebuild b/dev-python/nose/nose-1.3.7-r4.ebuild
31 new file mode 100644
32 index 00000000000..fdbf207e502
33 --- /dev/null
34 +++ b/dev-python/nose/nose-1.3.7-r4.ebuild
35 @@ -0,0 +1,98 @@
36 +# Copyright 1999-2019 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI=7
40 +
41 +PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy pypy3 )
42 +PYTHON_REQ_USE="threads(+)"
43 +
44 +inherit distutils-r1
45 +
46 +DESCRIPTION="Unittest extension with automatic test suite discovery and easy test authoring"
47 +HOMEPAGE="
48 + https://pypi.org/project/nose/
49 + https://nose.readthedocs.io/en/latest/
50 + https://github.com/nose-devs/nose"
51 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
52 +
53 +LICENSE="LGPL-2.1"
54 +SLOT="0"
55 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
56 +IUSE="coverage doc examples test"
57 +
58 +REQUIRED_USE="
59 + doc? ( || ( $(python_gen_useflags 'python2*') ) )"
60 +
61 +RDEPEND="
62 + dev-python/setuptools[${PYTHON_USEDEP}]
63 + coverage? ( dev-python/coverage[${PYTHON_USEDEP}] )"
64 +DEPEND="${RDEPEND}
65 + doc? ( >=dev-python/sphinx-0.6[${PYTHON_USEDEP}] )
66 + test? (
67 + dev-python/coverage[${PYTHON_USEDEP}]
68 + $(python_gen_cond_dep 'dev-python/twisted[${PYTHON_USEDEP}]' python2_7 python3_{5,6})
69 + )"
70 +
71 +PATCHES=(
72 + "${FILESDIR}"/${P}-python-3.5-backport.patch
73 +
74 + # Patch against master found in an upstream PR, backported:
75 + # https://github.com/nose-devs/nose/pull/1004
76 + "${FILESDIR}"/${P}-coverage-4.1-support.patch
77 +
78 + "${FILESDIR}"/${P}-python-3.6-test.patch
79 +)
80 +
81 +pkg_setup() {
82 + use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( 'python2*' )
83 +}
84 +
85 +python_prepare_all() {
86 + # Tests need to be converted, and they don't respect BUILD_DIR.
87 + use test && DISTUTILS_IN_SOURCE_BUILD=1
88 +
89 + # Disable tests requiring network connection.
90 + sed \
91 + -e "s/test_resolve/_&/g" \
92 + -e "s/test_raises_bad_return/_&/g" \
93 + -e "s/test_raises_twisted_error/_&/g" \
94 + -i unit_tests/test_twisted.py || die "sed failed"
95 + # Disable versioning of nosetests script to avoid collision with
96 + # versioning performed by the eclass.
97 + sed -e "/'nosetests%s = nose:run_exit' % py_vers_tag,/d" \
98 + -i setup.py || die "sed2 failed"
99 +
100 + # Prevent un-needed d'loading during doc build
101 + sed -e "s/, 'sphinx.ext.intersphinx'//" -i doc/conf.py || die
102 +
103 + distutils-r1_python_prepare_all
104 +}
105 +
106 +python_compile() {
107 + local add_targets=()
108 +
109 + if use test; then
110 + add_targets+=( egg_info )
111 + python_is_python3 && add_targets+=( build_tests )
112 + fi
113 +
114 + distutils-r1_python_compile ${add_targets[@]}
115 +}
116 +
117 +python_compile_all() {
118 + use doc && emake -C doc html
119 +}
120 +
121 +python_test() {
122 + "${EPYTHON}" selftest.py -v || die "Tests fail with ${EPYTHON}"
123 +}
124 +
125 +python_install() {
126 + distutils-r1_python_install --install-data "${EPREFIX}/usr/share"
127 +}
128 +
129 +python_install_all() {
130 + use examples && dodoc -r examples
131 + use doc && HTML_DOCS=( doc/.build/html/. )
132 + distutils-r1_python_install_all
133 +}