Gentoo Archives: gentoo-commits

From: "Arfrever Frehtes Taifersar Arahesis (arfrever)" <arfrever@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: distutils.eclass
Date: Sun, 28 Feb 2010 11:52:27
Message-Id: E1Nlhh8-0007f0-Ok@stork.gentoo.org
1 arfrever 10/02/28 11:52:22
2
3 Modified: distutils.eclass
4 Log:
5 Do not export distutils_src_unpack() in EAPI >=2 and disallow using of distutils_src_unpack() in EAPI >=2.
6 Improve output of distutils_src_compile(), distutils_src_test() and distutils_src_install().
7 Check for Jython-related directories in distutils_pkg_postinst() and distutils_pkg_postrm().
8
9 Revision Changes Path
10 1.73 eclass/distutils.eclass
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/distutils.eclass?rev=1.73&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/distutils.eclass?rev=1.73&content-type=text/plain
14 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/distutils.eclass?r1=1.72&r2=1.73
15
16 Index: distutils.eclass
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v
19 retrieving revision 1.72
20 retrieving revision 1.73
21 diff -u -r1.72 -r1.73
22 --- distutils.eclass 8 Feb 2010 09:35:38 -0000 1.72
23 +++ distutils.eclass 28 Feb 2010 11:52:22 -0000 1.73
24 @@ -1,6 +1,6 @@
25 # Copyright 1999-2010 Gentoo Foundation
26 # Distributed under the terms of the GNU General Public License v2
27 -# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.72 2010/02/08 09:35:38 pva Exp $
28 +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.73 2010/02/28 11:52:22 arfrever Exp $
29
30 # @ECLASS: distutils.eclass
31 # @MAINTAINER:
32 @@ -9,7 +9,7 @@
33 # Original author: Jon Nelson <jnelson@g.o>
34 # @BLURB: Eclass for packages with build systems using Distutils
35 # @DESCRIPTION:
36 -# The distutils eclass defines phase functions for packages with build systems using Distutils
37 +# The distutils eclass defines phase functions for packages with build systems using Distutils.
38
39 inherit multilib python
40
41 @@ -18,19 +18,19 @@
42 EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
43 ;;
44 *)
45 - EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm
46 + EXPORT_FUNCTIONS src_prepare src_compile src_install pkg_postinst pkg_postrm
47 ;;
48 esac
49
50 if [[ -z "${PYTHON_DEPEND}" ]]; then
51 - DEPEND="virtual/python"
52 + DEPEND="dev-lang/python"
53 RDEPEND="${DEPEND}"
54 fi
55
56 -if has "${EAPI:-0}" 0 1 2; then
57 +if has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
58 python="python"
59 else
60 - # Use "$(PYTHON)" or "$(PYTHON -A)" instead of "${python}".
61 + # Use "$(PYTHON)" instead of "${python}".
62 python="die"
63 fi
64
65 @@ -83,6 +83,11 @@
66 # Set this to disable renaming of Python scripts containing versioned shebangs
67 # and generation of wrapper scripts.
68
69 +# @ECLASS-VARIABLE: DISTUTILS_NONVERSIONED_PYTHON_SCRIPTS
70 +# @DESCRIPTION:
71 +# List of paths to Python scripts, relative to ${D}, which are excluded from
72 +# renaming and generation of wrapper scripts.
73 +
74 # @ECLASS-VARIABLE: DOCS
75 # @DESCRIPTION:
76 # Additional documentation files installed by distutils_src_install().
77 @@ -116,6 +121,10 @@
78 # @DESCRIPTION:
79 # The distutils src_unpack function. This function is exported.
80 distutils_src_unpack() {
81 + if ! has "${EAPI:-0}" 0 1; then
82 + die "${FUNCNAME}() cannot be used in this EAPI"
83 + fi
84 +
85 if [[ "${EBUILD_PHASE}" != "unpack" ]]; then
86 die "${FUNCNAME}() can be used only in src_unpack() phase"
87 fi
88 @@ -123,7 +132,7 @@
89 unpack ${A}
90 cd "${S}"
91
92 - has "${EAPI:-0}" 0 1 && distutils_src_prepare
93 + distutils_src_prepare
94 }
95
96 # @FUNCTION: distutils_src_prepare
97 @@ -165,19 +174,21 @@
98 die "${FUNCNAME}() can be used only in src_compile() phase"
99 fi
100
101 + _python_set_color_variables
102 +
103 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
104 distutils_building() {
105 _distutils_hook pre
106
107 - echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"
108 + echo ${_BOLD}"$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL}
109 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@" || return "$?"
110
111 _distutils_hook post
112 }
113 python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@"
114 else
115 - echo "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
116 - "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
117 + echo ${_BOLD}"$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"${_NORMAL}
118 + "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
119 fi
120 }
121
122 @@ -185,16 +196,18 @@
123 # @DESCRIPTION:
124 # The distutils src_test function. This function is exported, when DISTUTILS_SRC_TEST variable is set.
125 distutils_src_test() {
126 + _python_set_color_variables
127 +
128 if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then
129 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
130 distutils_testing() {
131 - echo PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@"
132 + echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@"${_NORMAL}
133 PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@"
134 }
135 python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@"
136 else
137 - echo PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed"
138 - PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed"
139 + echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL}
140 + PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed"
141 fi
142 elif [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
143 python_execute_nosetests -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
144 @@ -227,6 +240,8 @@
145 die "${FUNCNAME}() can be used only in src_install() phase"
146 fi
147
148 + _python_set_color_variables
149 +
150 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
151 if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge 4 ]]; then
152 declare -A wrapper_scripts=()
153 @@ -235,9 +250,12 @@
154 if [[ -d "${D}usr/bin" ]]; then
155 cd "${D}usr/bin"
156
157 - local file
158 + local nonversioned_file file
159 for file in *; do
160 - if [[ -f "${file}" && ! "${file}" =~ [[:digit:]]+\.[[:digit:]]+$ && "$(head -n1 "${file}")" =~ ^'#!'.*python[[:digit:]]+\.[[:digit:]]+ ]]; then
161 + if [[ -f "${file}" && ! "${file}" =~ [[:digit:]]+\.[[:digit:]](-jython)?+$ && "$(head -n1 "${file}")" =~ ^'#!'.*(python|jython-)[[:digit:]]+\.[[:digit:]]+ ]]; then
162 + for nonversioned_file in "${DISTUTILS_NONVERSIONED_PYTHON_SCRIPTS[@]}"; do
163 + [[ "${nonversioned_file}" == "/usr/bin/${file}" ]] && continue 2
164 + done
165 mv "${file}" "${file}-${PYTHON_ABI}" || die "Renaming of '${file}' failed"
166 wrapper_scripts+=(["${D}usr/bin/${file}"]=)
167 fi
168 @@ -249,7 +267,7 @@
169 distutils_installation() {
170 _distutils_hook pre
171
172 - echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --root="${D}" --no-compile "$@"
173 + echo ${_BOLD}"$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --root="${D}" --no-compile "$@"${_NORMAL}
174 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --root="${D}" --no-compile "$@" || return "$?"
175
176 if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge 4 ]]; then
177 @@ -268,8 +286,8 @@
178 # Mark the package to be rebuilt after a Python upgrade.
179 python_need_rebuild
180
181 - echo "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
182 - "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
183 + echo ${_BOLD}"$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"${_NORMAL}
184 + "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
185 fi
186
187 if [[ -e "${D}usr/local" ]]; then
188 @@ -302,7 +320,7 @@
189
190 local pylibdir pymod
191 if [[ -z "${PYTHON_MODNAME}" ]]; then
192 - for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
193 + for pylibdir in "${ROOT}"usr/$(get_libdir)/python* "${ROOT}"/usr/share/jython-*/Lib; do
194 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
195 PYTHON_MODNAME="${PN}"
196 fi
197 @@ -331,7 +349,7 @@
198
199 local pylibdir pymod
200 if [[ -z "${PYTHON_MODNAME}" ]]; then
201 - for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
202 + for pylibdir in "${ROOT}"usr/$(get_libdir)/python* "${ROOT}"/usr/share/jython-*/Lib; do
203 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
204 PYTHON_MODNAME="${PN}"
205 fi
206 @@ -343,9 +361,9 @@
207 python_mod_cleanup ${PYTHON_MODNAME}
208 else
209 for pymod in ${PYTHON_MODNAME}; do
210 - for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
211 + for pylibdir in "${ROOT}"usr/$(get_libdir)/python*; do
212 if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then
213 - python_mod_cleanup "${pylibdir#${ROOT}}/site-packages/${pymod}"
214 + python_mod_cleanup "${pylibdir#${ROOT%/}}/site-packages/${pymod}"
215 fi
216 done
217 done
218 @@ -359,7 +377,7 @@
219 # @DESCRIPTION:
220 # Deprecated wrapper function for deprecated python_version().
221 distutils_python_version() {
222 - if ! has "${EAPI:-0}" 0 1 2; then
223 + if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
224 eerror "Use PYTHON() and/or python_get_*() instead of ${FUNCNAME}()."
225 die "${FUNCNAME}() cannot be used in this EAPI"
226 fi
227 @@ -369,10 +387,10 @@
228
229 # @FUNCTION: distutils_python_tkinter
230 # @DESCRIPTION:
231 -# Deprecated wrapper function for python_tkinter_exists().
232 +# Deprecated wrapper function for deprecated python_tkinter_exists().
233 distutils_python_tkinter() {
234 - if ! has "${EAPI:-0}" 0 1 2; then
235 - eerror "Use python_tkinter_exists() instead of ${FUNCNAME}()."
236 + if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
237 + eerror "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()."
238 die "${FUNCNAME}() cannot be used in this EAPI"
239 fi