Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH v2 17/20] python-utils-r2.eclass: Remove PYTHON_SCRIPTDIR export
Date: Thu, 05 Mar 2020 15:17:03
Message-Id: 20200305151024.125834-18-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH v2 00/20] python-r2 suite by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/distutils-r2.eclass | 3 +--
4 eclass/python-r2.eclass | 3 +--
5 eclass/python-utils-r2.eclass | 21 +++++++--------------
6 eclass/tests/python-utils-r2.sh | 12 ++++++------
7 4 files changed, 15 insertions(+), 24 deletions(-)
8
9 diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass
10 index 99d93a2e830f..678dc670c3ef 100644
11 --- a/eclass/distutils-r2.eclass
12 +++ b/eclass/distutils-r2.eclass
13 @@ -732,8 +732,7 @@ _distutils-r2_wrap_scripts() {
14 local path=${1}
15 local bindir=${2}
16
17 - local PYTHON_SCRIPTDIR
18 - _python_export PYTHON_SCRIPTDIR
19 + local PYTHON_SCRIPTDIR=$(python_get_scriptdir)
20
21 local f python_files=() non_python_files=()
22
23 diff --git a/eclass/python-r2.eclass b/eclass/python-r2.eclass
24 index 02b60d4e4de9..93369b83e00a 100644
25 --- a/eclass/python-r2.eclass
26 +++ b/eclass/python-r2.eclass
27 @@ -760,8 +760,7 @@ python_replicate_script() {
28 _python_replicate_script() {
29 local _PYTHON_FIX_SHEBANG_QUIET=1
30
31 - local PYTHON_SCRIPTDIR
32 - _python_export PYTHON_SCRIPTDIR
33 + local PYTHON_SCRIPTDIR=$(python_get_scriptdir)
34
35 (
36 exeopts -m 0755
37 diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
38 index 026ef907a880..a18da95b2be5 100644
39 --- a/eclass/python-utils-r2.eclass
40 +++ b/eclass/python-utils-r2.eclass
41 @@ -298,11 +298,6 @@ _python_export() {
42 export PYTHON_PKG_DEP
43 debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}"
44 ;;
45 - PYTHON_SCRIPTDIR)
46 - local dir
47 - export PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl}
48 - debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}"
49 - ;;
50 *)
51 die "_python_export: unknown variable ${var}"
52 esac
53 @@ -446,16 +441,15 @@ python_get_PYTHON_CONFIG() {
54 }
55
56 # @FUNCTION: python_get_scriptdir
57 -# @USAGE: [<impl>]
58 # @DESCRIPTION:
59 -# Obtain and print the script install path for the given
60 -# implementation. If no implementation is provided, ${EPYTHON} will
61 -# be used.
62 +# Obtain and print the script install path for ${EPYTHON}.
63 python_get_scriptdir() {
64 debug-print-function ${FUNCNAME} "${@}"
65 + [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
66
67 - _python_export "${@}" PYTHON_SCRIPTDIR
68 - echo "${PYTHON_SCRIPTDIR}"
69 + local out=${EPREFIX}/usr/lib/python-exec/${impl}
70 + debug-print "${FUNCNAME} -> ${out}"
71 + echo "${out}"
72 }
73
74 # @FUNCTION: _python_ln_rel
75 @@ -622,9 +616,8 @@ python_newexe() {
76 local f=${1}
77 local newfn=${2}
78
79 - local PYTHON_SCRIPTDIR d
80 - _python_export PYTHON_SCRIPTDIR
81 - d=${PYTHON_SCRIPTDIR#${EPREFIX}}
82 + local PYTHON_SCRIPTDIR=$(python_get_scriptdir)
83 + local d=${PYTHON_SCRIPTDIR#${EPREFIX}}
84
85 (
86 dodir "${wrapd}"
87 diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
88 index 0b41a7bcdb53..b4b37efe179b 100755
89 --- a/eclass/tests/python-utils-r2.sh
90 +++ b/eclass/tests/python-utils-r2.sh
91 @@ -84,7 +84,7 @@ if [[ -x /usr/bin/python2.7 ]]; then
92 test_get LIBS python2.7 "*-lpython2.7*"
93 fi
94 test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
95 -test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
96 +test_get scriptdir python2.7 /usr/lib/python-exec/python2.7
97
98 test_var EPYTHON python3_6 python3.6
99 test_var PYTHON python3_6 /usr/bin/python3.6
100 @@ -98,7 +98,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
101 test_get LIBS python3.6 "*-lpython3.6*"
102 fi
103 test_var PYTHON_PKG_DEP python3_6 '*dev-lang/python*:3.6'
104 -test_var PYTHON_SCRIPTDIR python3_6 /usr/lib/python-exec/python3.6
105 +test_get scriptdir python3.6 /usr/lib/python-exec/python3.6
106
107 test_var EPYTHON python3_7 python3.7
108 test_var PYTHON python3_7 /usr/bin/python3.7
109 @@ -112,7 +112,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
110 test_get LIBS python3.7 "*-lpython3.7*"
111 fi
112 test_var PYTHON_PKG_DEP python3_7 '*dev-lang/python*:3.7'
113 -test_var PYTHON_SCRIPTDIR python3_7 /usr/lib/python-exec/python3.7
114 +test_get scriptdir python3.7 /usr/lib/python-exec/python3.7
115
116 test_var EPYTHON jython2_7 jython2.7
117 test_var PYTHON jython2_7 /usr/bin/jython2.7
118 @@ -120,7 +120,7 @@ if [[ -x /usr/bin/jython2.7 ]]; then
119 test_get sitedir jython2.7 /usr/share/jython-2.7/Lib/site-packages
120 fi
121 test_var PYTHON_PKG_DEP jython2_7 '*dev-java/jython*:2.7'
122 -test_var PYTHON_SCRIPTDIR jython2_7 /usr/lib/python-exec/jython2.7
123 +test_get scriptdir jython2.7 /usr/lib/python-exec/jython2.7
124
125 test_var EPYTHON pypy pypy
126 test_var PYTHON pypy /usr/bin/pypy
127 @@ -129,7 +129,7 @@ if [[ -x /usr/bin/pypy ]]; then
128 test_get includedir pypy "/usr/lib*/pypy2.7/include"
129 fi
130 test_var PYTHON_PKG_DEP pypy '*dev-python/pypy*:0='
131 -test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy
132 +test_get scriptdir pypy /usr/lib/python-exec/pypy
133
134 test_var EPYTHON pypy3 pypy3
135 test_var PYTHON pypy3 /usr/bin/pypy3
136 @@ -138,7 +138,7 @@ if [[ -x /usr/bin/pypy3 ]]; then
137 test_get includedir pypy3 "/usr/lib*/pypy3.?/include"
138 fi
139 test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0='
140 -test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
141 +test_get scriptdir pypy3 /usr/lib/python-exec/pypy3
142
143 test_is "python_is_python3 python2.7" 1
144 test_is "python_is_python3 python3.2" 0
145 --
146 2.25.1