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: eclass/
Date: Tue, 29 Jun 2021 06:05:09
Message-Id: 1624946696.7e33b5a5b6f260d72e01591db3978ec8923b298d.mgorny@gentoo
1 commit: 7e33b5a5b6f260d72e01591db3978ec8923b298d
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 25 19:42:37 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 29 06:04:56 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7e33b5a5
7
8 distutils-r1.eclass: Eliminate path arg to ..._wrap_scripts
9
10 Eliminate the path argument to _distutils-r1_wrap_scripts, and inline
11 the use of ${D} instead. This should make the code less confusing.
12
13 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
14
15 eclass/distutils-r1.eclass | 25 ++++++++++++-------------
16 1 file changed, 12 insertions(+), 13 deletions(-)
17
18 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
19 index 33608eb9fcc..3d50cd5a2f2 100644
20 --- a/eclass/distutils-r1.eclass
21 +++ b/eclass/distutils-r1.eclass
22 @@ -740,24 +740,23 @@ distutils-r1_python_compile() {
23 }
24
25 # @FUNCTION: _distutils-r1_wrap_scripts
26 -# @USAGE: <path> <bindir>
27 +# @USAGE: <bindir>
28 # @INTERNAL
29 # @DESCRIPTION:
30 # Moves and wraps all installed scripts/executables as necessary.
31 _distutils-r1_wrap_scripts() {
32 debug-print-function ${FUNCNAME} "${@}"
33
34 - [[ ${#} -eq 2 ]] || die "usage: ${FUNCNAME} <path> <bindir>"
35 - local path=${1}
36 - local bindir=${2}
37 + [[ ${#} -eq 1 ]] || die "usage: ${FUNCNAME} <bindir>"
38 + local bindir=${1}
39
40 local scriptdir=$(python_get_scriptdir)
41 local f python_files=() non_python_files=()
42
43 - if [[ -d ${path}${scriptdir} ]]; then
44 - for f in "${path}${scriptdir}"/*; do
45 + if [[ -d ${D%/}${scriptdir} ]]; then
46 + for f in "${D%/}${scriptdir}"/*; do
47 [[ -d ${f} ]] && die "Unexpected directory: ${f}"
48 - debug-print "${FUNCNAME}: found executable at ${f#${path}/}"
49 + debug-print "${FUNCNAME}: found executable at ${f#${D%/}/}"
50
51 local shebang
52 read -r shebang < "${f}"
53 @@ -769,22 +768,22 @@ _distutils-r1_wrap_scripts() {
54 non_python_files+=( "${f}" )
55 fi
56
57 - mkdir -p "${path}${bindir}" || die
58 + mkdir -p "${D%/}${bindir}" || die
59 done
60
61 for f in "${python_files[@]}"; do
62 local basename=${f##*/}
63
64 debug-print "${FUNCNAME}: installing wrapper at ${bindir}/${basename}"
65 - _python_ln_rel "${path}${EPREFIX}"/usr/lib/python-exec/python-exec2 \
66 - "${path}${bindir}/${basename}" || die
67 + _python_ln_rel "${ED%/}"/usr/lib/python-exec/python-exec2 \
68 + "${D%/}${bindir}/${basename}" || die
69 done
70
71 for f in "${non_python_files[@]}"; do
72 local basename=${f##*/}
73
74 - debug-print "${FUNCNAME}: moving ${f#${path}/} to ${bindir}/${basename}"
75 - mv "${f}" "${path}${bindir}/${basename}" || die
76 + debug-print "${FUNCNAME}: moving ${f#${D%/}/} to ${bindir}/${basename}"
77 + mv "${f}" "${D%/}${bindir}/${basename}" || die
78 done
79 fi
80 }
81 @@ -922,7 +921,7 @@ distutils-r1_python_install() {
82
83 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
84 multibuild_merge_root "${root}" "${D%/}"
85 - _distutils-r1_wrap_scripts "${D%/}" "${scriptdir}"
86 + _distutils-r1_wrap_scripts "${scriptdir}"
87 fi
88 }