Gentoo Archives: gentoo-commits

From: Louis Sautier <sbraz@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/flake8/, dev-python/flake8/files/
Date: Fri, 02 Oct 2020 13:08:32
Message-Id: 1601644102.374ffcd390ba715c76bc69084eca4abae42c512d.sbraz@gentoo
1 commit: 374ffcd390ba715c76bc69084eca4abae42c512d
2 Author: Louis Sautier <sbraz <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 2 12:32:12 2020 +0000
4 Commit: Louis Sautier <sbraz <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 2 13:08:22 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=374ffcd3
7
8 dev-python/flake8: bump to 3.8.3, fix tests, re-add doc
9
10 Closes: https://bugs.gentoo.org/706310
11 Package-Manager: Portage-3.0.8, Repoman-3.0.1
12 Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org>
13
14 dev-python/flake8/Manifest | 1 +
15 dev-python/flake8/files/flake8-3.8.3-pytest6.patch | 40 ++++++++++++++++++
16 dev-python/flake8/flake8-3.8.3.ebuild | 47 ++++++++++++++++++++++
17 3 files changed, 88 insertions(+)
18
19 diff --git a/dev-python/flake8/Manifest b/dev-python/flake8/Manifest
20 index ef65d6c22b0..26713f2ebbc 100644
21 --- a/dev-python/flake8/Manifest
22 +++ b/dev-python/flake8/Manifest
23 @@ -1 +1,2 @@
24 DIST flake8-3.8.1.tar.gz 157166 BLAKE2B cc8b2dc11f78a6b9c62662086cc190a29a0a4e5a228d4823de8e2f3f327cea3e5df4db220faf9cc14fa34e3825b7d1e4fc4ccf9d1205b437903f327f3ebfa7bb SHA512 f73a306be7d8e5bc48dd9d6d8f8cdee07a90c6c38ee7bd37a21f4be23f1812e4a1e214cc75ca1a324f40e750312b5d7ed573ff49d673f9a1f33aad188b108add
25 +DIST flake8-3.8.3.tar.gz 162305 BLAKE2B 7211c9ff99ce2e8e3094e6a7a1917ee1b3d61902a45408b9c84f077097af8d1b0571e27209ed78409c9931ff53fdb660f81d1886773b8ef74ceb0bd3de60420c SHA512 007158ea5caf60ff84e935f1b74a5f746fba00991c8808395ff72126dc1a8c8e135badc6f1f383027349076b8f3e146e9d0af27b6e24cdf97390463fd69ad940
26
27 diff --git a/dev-python/flake8/files/flake8-3.8.3-pytest6.patch b/dev-python/flake8/files/flake8-3.8.3-pytest6.patch
28 new file mode 100644
29 index 00000000000..78e7391d037
30 --- /dev/null
31 +++ b/dev-python/flake8/files/flake8-3.8.3-pytest6.patch
32 @@ -0,0 +1,40 @@
33 +commit 91b09d5b376cfb8afd4b6af5b407f57aa42011c7
34 +Author: Miro Hrončok <miro@×××××××.cz>
35 +Date: Mon Jul 20 13:18:23 2020 +0200
36 +
37 + Tests: Add a value to mocked entry_points, so pytest 6+ can log it
38 +
39 + Pytest 6.0.0rc1 attempts to log a repr of our mocked entry_point,
40 + but it fails, becasue the repr metohod expects a valua attribute:
41 +
42 + Reproducer:
43 +
44 + $ tox -e py38 --force-dep 'pytest==6.0.0rc1'
45 + ...
46 + Traceback (most recent call last):
47 + File "/usr/lib/python3.8/logging/__init__.py", line 1081, in emit
48 + msg = self.format(record)
49 + File "/usr/lib/python3.8/logging/__init__.py", line 925, in format
50 + return fmt.format(record)
51 + File "/usr/lib/python3.8/logging/__init__.py", line 664, in format
52 + record.message = record.getMessage()
53 + File "/usr/lib/python3.8/logging/__init__.py", line 369, in getMessage
54 + msg = msg % self.args
55 + File "/tmp/flake8/.tox/py38/lib/python3.8/site-packages/flake8/plugins/manager.py", line 44, in __repr__
56 + self.name, self.entry_point.value
57 + File "/tmp/flake8/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 632, in __getattr__
58 + raise AttributeError("Mock object has no attribute %r" % name)
59 + AttributeError: Mock object has no attribute 'value'
60 +
61 +diff --git a/tests/integration/test_checker.py b/tests/integration/test_checker.py
62 +index eaab5c3..0acdb6e 100644
63 +--- a/tests/integration/test_checker.py
64 ++++ b/tests/integration/test_checker.py
65 +@@ -100,6 +100,7 @@ def mock_file_checker_with_plugin(plugin_target):
66 + entry_point = mock.Mock(spec=['load'])
67 + entry_point.name = plugin_target.name
68 + entry_point.load.return_value = plugin_target
69 ++ entry_point.value = 'mocked:value'
70 +
71 + # Load the checker plugins using the entry point mock
72 + with mock.patch.object(
73
74 diff --git a/dev-python/flake8/flake8-3.8.3.ebuild b/dev-python/flake8/flake8-3.8.3.ebuild
75 new file mode 100644
76 index 00000000000..7fb88e57ff1
77 --- /dev/null
78 +++ b/dev-python/flake8/flake8-3.8.3.ebuild
79 @@ -0,0 +1,47 @@
80 +# Copyright 1999-2020 Gentoo Authors
81 +# Distributed under the terms of the GNU General Public License v2
82 +
83 +EAPI=7
84 +
85 +PYTHON_COMPAT=( pypy3 python3_{6..8} )
86 +DISTUTILS_USE_SETUPTOOLS=rdepend
87 +
88 +inherit distutils-r1
89 +
90 +DESCRIPTION="A wrapper around PyFlakes, pep8 & mccabe"
91 +HOMEPAGE="https://gitlab.com/pycqa/flake8 https://pypi.org/project/flake8/"
92 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
93 +
94 +LICENSE="MIT"
95 +SLOT="0"
96 +KEYWORDS="~amd64 ~s390 ~x86"
97 +
98 +# requires.txt inc. mccabe however that creates a circular dep
99 +RDEPEND="
100 + >=dev-python/pyflakes-2.2.0[${PYTHON_USEDEP}]
101 + <dev-python/pyflakes-2.3.0[${PYTHON_USEDEP}]
102 + >=dev-python/pycodestyle-2.6.0[${PYTHON_USEDEP}]
103 + <dev-python/pycodestyle-2.7.0[${PYTHON_USEDEP}]
104 + dev-python/importlib_metadata[${PYTHON_USEDEP}]
105 +"
106 +PDEPEND="
107 + >=dev-python/mccabe-0.6.0[${PYTHON_USEDEP}]
108 + <dev-python/mccabe-0.7.0[${PYTHON_USEDEP}]
109 +"
110 +BDEPEND="${RDEPEND}
111 + test? (
112 + ${PDEPEND}
113 + >=dev-python/mock-2.0.0[${PYTHON_USEDEP}]
114 + )
115 +"
116 +
117 +PATCHES=( "${FILESDIR}/${P}-pytest6.patch" )
118 +
119 +distutils_enable_sphinx docs/source dev-python/sphinx-prompt dev-python/sphinx_rtd_theme
120 +distutils_enable_tests pytest
121 +
122 +python_test() {
123 + # Otherwise some tests fail if the package isn't installed
124 + distutils_install_for_testing
125 + pytest -vv || die "Tests fail with ${EPYTHON}"
126 +}