Gentoo Archives: gentoo-dev

From: "M. J. Everitt" <m.j.everitt@×××.org>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-dev] [PATCH] distutils-r1.eclass: Warn if *-nspkg.pth files are installed
Date: Fri, 05 May 2017 21:19:33
Message-Id: c8f2355e-7a14-944e-c172-2222d117ede7@iee.org
In Reply to: [gentoo-dev] [PATCH] distutils-r1.eclass: Warn if *-nspkg.pth files are installed by "Michał Górny"
1 On 05/05/17 22:14, Michał Górny wrote:
2 > Add a check for *-nspkg.pth files indicating implicit setuptools
3 > namespace hack. While they kept namespaces somewhat working without
4 > requiring explicit support in ebuilds, they were unreliable. They
5 > frequently required additional hacks (distutils_install_for_testing) to
6 > get the tests working, and they have proven even more broken for Python
7 > 3.5+.
8 >
9 > For this reason, those files were deprecated in favor of proper,
10 > explicit namespace support. If they are found to exist, the developer
11 > should ensure to remove them to avoid issues.
12 > ---
13 > eclass/distutils-r1.eclass | 29 +++++++++++++++++++++++++++++
14 > 1 file changed, 29 insertions(+)
15 >
16 > **REVIEW NOTE**
17 >
18 > The wiki documentation update is not yet in place for the new policy
19 > is not yet in place. In fact, it's not even guaranteed that the policy
20 > will actually be approved. The discussion is taking place here:
21
22 The wiki documentation update is not yet in place for the new policy
23 is not yet in place. ???
24
25 Copy-pasta, sir .. :]
26
27 > https://archives.gentoo.org/gentoo-python/message/d74af64a795cb776ac7b4f285963072d
28 >
29 > diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
30 > index 3be67bbf2a21..5df7234332d3 100644
31 > --- a/eclass/distutils-r1.eclass
32 > +++ b/eclass/distutils-r1.eclass
33 > @@ -789,6 +789,33 @@ distutils-r1_src_test() {
34 > fi
35 > }
36 >
37 > +# @FUNCTION: _distutils-r1_check_namespace_pth
38 > +# @INTERNAL
39 > +# @DESCRIPTION:
40 > +# Check if any *-nspkg.pth files were installed (by setuptools)
41 > +# and warn about the policy non-conformance if they were.
42 > +_distutils-r1_check_namespace_pth() {
43 > + local f pth=()
44 > +
45 > + while IFS= read -r -d '' f; do
46 > + pth+=( "${f}" )
47 > + done < <(find "${ED}" -name '*-nspkg.pth' -print0)
48 > +
49 > + if [[ ${pth[@]} ]]; then
50 > + ewarn "The following *-nspkg.pth files were found installed:"
51 > + ewarn
52 > + for f in "${pth[@]}"; do
53 > + ewarn " ${f#${ED%/}}"
54 > + done
55 > + ewarn
56 > + ewarn "The presence of those files may break namespaces in Python 3.5+. Please"
57 > + ewarn "read our documentation on reliable handling of namespaces and update"
58 > + ewarn "the ebuild accordingly:"
59 > + ewarn
60 > + ewarn " https://wiki.gentoo.org/wiki/Project:Python/Namespace_packages"
61 > + fi
62 > +}
63 > +
64 > distutils-r1_src_install() {
65 > debug-print-function ${FUNCNAME} "${@}"
66 >
67 > @@ -812,6 +839,8 @@ distutils-r1_src_install() {
68 >
69 > "${cmd}" "QA: python_install_all() didn't call distutils-r1_python_install_all"
70 > fi
71 > +
72 > + _distutils-r1_check_namespace_pth
73 > }
74 >
75 > # -- distutils.eclass functions --

Attachments

File name MIME type
signature.asc application/pgp-signature