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/18] distutils-r1.eclass: Move install QA checks to post-phase function
Date: Sat, 04 Jun 2022 09:05:03
Message-Id: 20220604090334.4003-5-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 00/18] distutils-r1.eclass D_U_PEP517=no mode & other patches by "Michał Górny"
1 Perform the install QA check (the invalid package name check) in a post-
2 phase function. This enables it to be performed even when
3 distutils-r1_python_install is not used.
4
5 Signed-off-by: Michał Górny <mgorny@g.o>
6 ---
7 eclass/distutils-r1.eclass | 54 ++++++++++++++++++++++----------------
8 1 file changed, 31 insertions(+), 23 deletions(-)
9
10 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
11 index b690f21f9159..30391ad67f3a 100644
12 --- a/eclass/distutils-r1.eclass
13 +++ b/eclass/distutils-r1.eclass
14 @@ -1566,29 +1566,6 @@ distutils-r1_python_install() {
15 esetup.py "${args[@]}"
16 fi
17
18 - local forbidden_package_names=(
19 - examples test tests
20 - .pytest_cache .hypothesis
21 - )
22 - local p
23 - for p in "${forbidden_package_names[@]}"; do
24 - if [[ -d ${root}$(python_get_sitedir)/${p} ]]; then
25 - die "Package installs '${p}' package which is forbidden and likely a bug in the build system."
26 - fi
27 - done
28 -
29 - local shopt_save=$(shopt -p nullglob)
30 - shopt -s nullglob
31 - local pypy_dirs=(
32 - "${root}${EPREFIX}/usr/$(get_libdir)"/pypy*/share
33 - "${root}${EPREFIX}/usr/lib"/pypy*/share
34 - )
35 - ${shopt_save}
36 -
37 - if [[ -n ${pypy_dirs} ]]; then
38 - die "Package installs 'share' in PyPy prefix, see bug #465546."
39 - fi
40 -
41 if [[ ! ${DISTUTILS_SINGLE_IMPL} || ${DISTUTILS_USE_PEP517} ]]; then
42 multibuild_merge_root "${root}" "${D%/}"
43 if [[ ${DISTUTILS_USE_PEP517} ]]; then
44 @@ -1845,6 +1822,37 @@ distutils-r1_src_test() {
45 return ${ret}
46 }
47
48 +# @FUNCTION: _distutils-r1_post_python_install
49 +# @INTERNAL
50 +# @DESCRIPTION:
51 +# Post-phase function called after python_install.
52 +_distutils-r1_post_python_install() {
53 + debug-print-function ${FUNCNAME} "${@}"
54 +
55 + local forbidden_package_names=(
56 + examples test tests
57 + .pytest_cache .hypothesis
58 + )
59 + local p
60 + for p in "${forbidden_package_names[@]}"; do
61 + if [[ -d ${D}$(python_get_sitedir)/${p} ]]; then
62 + die "Package installs '${p}' package which is forbidden and likely a bug in the build system."
63 + fi
64 + done
65 +
66 + local shopt_save=$(shopt -p nullglob)
67 + shopt -s nullglob
68 + local pypy_dirs=(
69 + "${D}${EPREFIX}/usr/$(get_libdir)"/pypy*/share
70 + "${D}${EPREFIX}/usr/lib"/pypy*/share
71 + )
72 + ${shopt_save}
73 +
74 + if [[ -n ${pypy_dirs} ]]; then
75 + die "Package installs 'share' in PyPy prefix, see bug #465546."
76 + fi
77 +}
78 +
79 # @FUNCTION: _distutils-r1_check_namespace_pth
80 # @INTERNAL
81 # @DESCRIPTION:
82 --
83 2.35.1