/[gentoo-x86]/eclass/distutils.eclass
Gentoo

Diff of /eclass/distutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.71 Revision 1.78
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2010 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.71 2010/02/07 21:17:15 pva Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.78 2010/12/13 13:36:33 arfrever Exp $
4 4
5# @ECLASS: distutils.eclass 5# @ECLASS: distutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Gentoo Python Project <python@gentoo.org> 7# Gentoo Python Project <python@gentoo.org>
8# 8#
9# Original author: Jon Nelson <jnelson@gentoo.org> 9# Original author: Jon Nelson <jnelson@gentoo.org>
10# @BLURB: Eclass for packages with build systems using Distutils 10# @BLURB: Eclass for packages with build systems using Distutils
11# @DESCRIPTION: 11# @DESCRIPTION:
12# The distutils eclass defines phase functions for packages with build systems using Distutils 12# The distutils eclass defines phase functions for packages with build systems using Distutils.
13 13
14inherit eutils multilib python 14inherit multilib python
15 15
16case "${EAPI:-0}" in 16case "${EAPI:-0}" in
17 0|1) 17 0|1)
18 EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm 18 EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
19 ;; 19 ;;
20 *) 20 *)
21 EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm 21 EXPORT_FUNCTIONS src_prepare src_compile src_install pkg_postinst pkg_postrm
22 ;; 22 ;;
23esac 23esac
24 24
25if [[ -z "${PYTHON_DEPEND}" ]]; then 25if [[ -z "$(declare -p PYTHON_DEPEND 2> /dev/null)" ]]; then
26 DEPEND="virtual/python" 26 DEPEND="dev-lang/python"
27 RDEPEND="${DEPEND}" 27 RDEPEND="${DEPEND}"
28fi 28fi
29 29
30if has "${EAPI:-0}" 0 1 2; then 30# 'python' variable is deprecated. Use PYTHON() instead.
31if has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
31 python="python" 32 python="python"
32else 33else
33 # Use "$(PYTHON)" or "$(PYTHON -A)" instead of "${python}".
34 python="die" 34 python="die"
35fi 35fi
36 36
37# @ECLASS-VARIABLE: DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES 37# @ECLASS-VARIABLE: DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES
38# @DESCRIPTION: 38# @DESCRIPTION:
39# Set this to use separate source directories for each enabled version of Python. 39# Set this to use separate source directories for each enabled version of Python.
40 40
41# @ECLASS-VARIABLE: DISTUTILS_SETUP_FILES
42# @DESCRIPTION:
43# Paths to setup files.
44
41# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS 45# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS
42# @DESCRIPTION: 46# @DESCRIPTION:
43# Global options passed to setup.py. 47# Global options passed to setup files.
44 48
45# @ECLASS-VARIABLE: DISTUTILS_SRC_TEST 49# @ECLASS-VARIABLE: DISTUTILS_SRC_TEST
46# @DESCRIPTION: 50# @DESCRIPTION:
47# Type of test command used by distutils_src_test(). 51# Type of test command used by distutils_src_test().
48# IUSE and DEPEND are automatically adjusted, unless DISTUTILS_DISABLE_TEST_DEPENDENCY is set. 52# IUSE and DEPEND are automatically adjusted, unless DISTUTILS_DISABLE_TEST_DEPENDENCY is set.
64 if [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then 68 if [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
65 IUSE="test" 69 IUSE="test"
66 DEPEND+="${DEPEND:+ }test? ( dev-python/nose )" 70 DEPEND+="${DEPEND:+ }test? ( dev-python/nose )"
67 elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then 71 elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
68 IUSE="test" 72 IUSE="test"
69 DEPEND+="${DEPEND:+ }test? ( dev-python/py )" 73 DEPEND+="${DEPEND:+ }test? ( dev-python/pytest )"
70 # trial requires an argument, which is usually equal to "${PN}". 74 # trial requires an argument, which is usually equal to "${PN}".
71 elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then 75 elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
72 IUSE="test" 76 IUSE="test"
73 DEPEND+="${DEPEND:+ }test? ( dev-python/twisted )" 77 DEPEND+="${DEPEND:+ }test? ( dev-python/twisted )"
74 fi 78 fi
81# @ECLASS-VARIABLE: DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS 85# @ECLASS-VARIABLE: DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS
82# @DESCRIPTION: 86# @DESCRIPTION:
83# Set this to disable renaming of Python scripts containing versioned shebangs 87# Set this to disable renaming of Python scripts containing versioned shebangs
84# and generation of wrapper scripts. 88# and generation of wrapper scripts.
85 89
90# @ECLASS-VARIABLE: DISTUTILS_NONVERSIONED_PYTHON_SCRIPTS
91# @DESCRIPTION:
92# List of paths to Python scripts, relative to ${ED}, which are excluded from
93# renaming and generation of wrapper scripts.
94
86# @ECLASS-VARIABLE: DOCS 95# @ECLASS-VARIABLE: DOCS
87# @DESCRIPTION: 96# @DESCRIPTION:
88# Additional documentation files installed by distutils_src_install(). 97# Additional documentation files installed by distutils_src_install().
89 98
90_distutils_get_build_dir() { 99_distutils_get_build_dir() {
91 if [[ -n "${SUPPORT_PYTHON_ABIS}" && -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then 100 if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
92 echo "build-${PYTHON_ABI}" 101 echo "build-${PYTHON_ABI}"
93 else 102 else
94 echo "build" 103 echo "build"
95 fi 104 fi
96} 105}
97 106
98_distutils_get_PYTHONPATH() { 107_distutils_get_PYTHONPATH() {
99 if [[ -n "${SUPPORT_PYTHON_ABIS}" && -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then 108 if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
100 ls -d build-${PYTHON_ABI}/lib* 2> /dev/null 109 ls -d build-${PYTHON_ABI}/lib* 2> /dev/null
101 else 110 else
102 ls -d build/lib* 2> /dev/null 111 ls -d build/lib* 2> /dev/null
103 fi 112 fi
104} 113}
114 123
115# @FUNCTION: distutils_src_unpack 124# @FUNCTION: distutils_src_unpack
116# @DESCRIPTION: 125# @DESCRIPTION:
117# The distutils src_unpack function. This function is exported. 126# The distutils src_unpack function. This function is exported.
118distutils_src_unpack() { 127distutils_src_unpack() {
128 if ! has "${EAPI:-0}" 0 1; then
129 die "${FUNCNAME}() cannot be used in this EAPI"
130 fi
131
119 if [[ "${EBUILD_PHASE}" != "unpack" ]]; then 132 if [[ "${EBUILD_PHASE}" != "unpack" ]]; then
120 die "${FUNCNAME}() can be used only in src_unpack() phase" 133 die "${FUNCNAME}() can be used only in src_unpack() phase"
121 fi 134 fi
122 135
123 unpack ${A} 136 unpack ${A}
124 cd "${S}" 137 cd "${S}"
125 138
126 has "${EAPI:-0}" 0 1 && distutils_src_prepare 139 distutils_src_prepare
127} 140}
128 141
129# @FUNCTION: distutils_src_prepare 142# @FUNCTION: distutils_src_prepare
130# @DESCRIPTION: 143# @DESCRIPTION:
131# The distutils src_prepare function. This function is exported. 144# The distutils src_prepare function. This function is exported.
163distutils_src_compile() { 176distutils_src_compile() {
164 if [[ "${EBUILD_PHASE}" != "compile" ]]; then 177 if [[ "${EBUILD_PHASE}" != "compile" ]]; then
165 die "${FUNCNAME}() can be used only in src_compile() phase" 178 die "${FUNCNAME}() can be used only in src_compile() phase"
166 fi 179 fi
167 180
168 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 181 _python_set_color_variables
182
183 if _python_package_supporting_installation_for_multiple_python_abis; then
169 distutils_building() { 184 distutils_building() {
170 _distutils_hook pre 185 _distutils_hook pre
171 186
187 local setup_file
188 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
172 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@" 189 echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL}
173 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@" || return "$?" 190 "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@" || return "$?"
191 done
174 192
175 _distutils_hook post 193 _distutils_hook post
176 } 194 }
177 python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@" 195 python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@"
178 else 196 else
197 local setup_file
198 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
179 echo "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" 199 echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"${_NORMAL}
180 "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed" 200 "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
201 done
202 fi
203}
204
205_distutils_src_test_hook() {
206 if [[ "$#" -ne 1 ]]; then
207 die "${FUNCNAME}() requires 1 arguments"
208 fi
209
210 if ! _python_package_supporting_installation_for_multiple_python_abis; then
211 return
212 fi
213
214 if [[ "$(type -t "distutils_src_test_pre_hook")" == "function" ]]; then
215 eval "python_execute_$1_pre_hook() {
216 distutils_src_test_pre_hook
217 }"
218 fi
219
220 if [[ "$(type -t "distutils_src_test_post_hook")" == "function" ]]; then
221 eval "python_execute_$1_post_hook() {
222 distutils_src_test_post_hook
223 }"
181 fi 224 fi
182} 225}
183 226
184# @FUNCTION: distutils_src_test 227# @FUNCTION: distutils_src_test
185# @DESCRIPTION: 228# @DESCRIPTION:
186# The distutils src_test function. This function is exported, when DISTUTILS_SRC_TEST variable is set. 229# The distutils src_test function. This function is exported, when DISTUTILS_SRC_TEST variable is set.
230# In ebuilds of packages supporting installation for multiple versions of Python, this function
231# calls distutils_src_test_pre_hook() and distutils_src_test_post_hook(), if they are defined.
187distutils_src_test() { 232distutils_src_test() {
233 if [[ "${EBUILD_PHASE}" != "test" ]]; then
234 die "${FUNCNAME}() can be used only in src_test() phase"
235 fi
236
237 _python_set_color_variables
238
188 if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then 239 if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then
189 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 240 if _python_package_supporting_installation_for_multiple_python_abis; then
190 distutils_testing() { 241 distutils_testing() {
242 _distutils_hook pre
243
244 local setup_file
245 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
191 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 "$@" 246 echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@"${_NORMAL}
192 PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@" 247 PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@" || return "$?"
248 done
249
250 _distutils_hook post
193 } 251 }
194 python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@" 252 python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@"
195 else 253 else
254 local setup_file
255 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
196 echo PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed" 256 echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL}
197 PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed" 257 PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed"
258 done
198 fi 259 fi
199 elif [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then 260 elif [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
261 _distutils_src_test_hook nosetests
262
200 python_execute_nosetests -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@" 263 python_execute_nosetests -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
201 elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then 264 elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
265 _distutils_src_test_hook py.test
266
202 python_execute_py.test -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@" 267 python_execute_py.test -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
203 # trial requires an argument, which is usually equal to "${PN}". 268 # trial requires an argument, which is usually equal to "${PN}".
204 elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then 269 elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
205 local trial_arguments 270 local trial_arguments
206 if [[ "${DISTUTILS_SRC_TEST}" == "trial "* ]]; then 271 if [[ "${DISTUTILS_SRC_TEST}" == "trial "* ]]; then
207 trial_arguments="${DISTUTILS_SRC_TEST#trial }" 272 trial_arguments="${DISTUTILS_SRC_TEST#trial }"
208 else 273 else
209 trial_arguments="${PN}" 274 trial_arguments="${PN}"
210 fi 275 fi
211 276
277 _distutils_src_test_hook trial
278
212 python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- ${trial_arguments} "$@" 279 python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- ${trial_arguments} "$@"
213 else 280 else
214 die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'" 281 die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
215 fi 282 fi
216} 283}
225distutils_src_install() { 292distutils_src_install() {
226 if [[ "${EBUILD_PHASE}" != "install" ]]; then 293 if [[ "${EBUILD_PHASE}" != "install" ]]; then
227 die "${FUNCNAME}() can be used only in src_install() phase" 294 die "${FUNCNAME}() can be used only in src_install() phase"
228 fi 295 fi
229 296
230 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 297 _python_initialize_prefix_variables
298 _python_set_color_variables
299
300 if _python_package_supporting_installation_for_multiple_python_abis; then
231 if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge 4 ]]; then 301 if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge 4 ]]; then
232 declare -A wrapper_scripts=() 302 declare -A wrapper_scripts=()
233 303
234 rename_scripts_with_versioned_shebangs() { 304 rename_scripts_with_versioned_shebangs() {
235 if [[ -d "${D}usr/bin" ]]; then 305 if [[ -d "${ED}usr/bin" ]]; then
236 cd "${D}usr/bin" 306 cd "${ED}usr/bin"
237 307
238 local file 308 local nonversioned_file file
239 for file in *; do 309 for file in *; do
240 if [[ -f "${file}" && ! "${file}" =~ [[:digit:]]+\.[[:digit:]]+$ && "$(head -n1 "${file}")" =~ ^'#!'.*python[[:digit:]]+\.[[:digit:]]+ ]]; then 310 if [[ -f "${file}" && ! "${file}" =~ [[:digit:]]+\.[[:digit:]]+(-jython)?$ && "$(head -n1 "${file}")" =~ ^'#!'.*(python|jython-)[[:digit:]]+\.[[:digit:]]+ ]]; then
311 for nonversioned_file in "${DISTUTILS_NONVERSIONED_PYTHON_SCRIPTS[@]}"; do
312 [[ "${nonversioned_file}" == "/usr/bin/${file}" ]] && continue 2
313 done
241 mv "${file}" "${file}-${PYTHON_ABI}" || die "Renaming of '${file}' failed" 314 mv "${file}" "${file}-${PYTHON_ABI}" || die "Renaming of '${file}' failed"
242 wrapper_scripts+=(["${D}usr/bin/${file}"]=) 315 wrapper_scripts+=(["${ED}usr/bin/${file}"]=)
243 fi 316 fi
244 done 317 done
245 fi 318 fi
246 } 319 }
247 fi 320 fi
248 321
249 distutils_installation() { 322 distutils_installation() {
250 _distutils_hook pre 323 _distutils_hook pre
251 324
325 local setup_file
326 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
252 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 "$@" 327 echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --root="${D}" --no-compile "$@"${_NORMAL}
253 "$(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 "$?" 328 "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --root="${D}" --no-compile "$@" || return "$?"
329 done
254 330
255 if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge 4 ]]; then 331 if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge 4 ]]; then
256 rename_scripts_with_versioned_shebangs 332 rename_scripts_with_versioned_shebangs
257 fi 333 fi
258 334
266 unset wrapper_scripts 342 unset wrapper_scripts
267 else 343 else
268 # Mark the package to be rebuilt after a Python upgrade. 344 # Mark the package to be rebuilt after a Python upgrade.
269 python_need_rebuild 345 python_need_rebuild
270 346
347 local setup_file
348 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
271 echo "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" 349 echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"${_NORMAL}
272 "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed" 350 "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
351 done
273 fi 352 fi
274 353
275 if [[ -e "${D}usr/local" ]]; then 354 if [[ -e "${ED}usr/local" ]]; then
276 die "Illegal installation into /usr/local" 355 die "Illegal installation into /usr/local"
277 fi 356 fi
278 357
279 local default_docs 358 local default_docs
280 default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS MANIFEST* NEWS PKG-INFO README* TODO" 359 default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS MANIFEST* NEWS PKG-INFO README* TODO"
298distutils_pkg_postinst() { 377distutils_pkg_postinst() {
299 if [[ "${EBUILD_PHASE}" != "postinst" ]]; then 378 if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
300 die "${FUNCNAME}() can be used only in pkg_postinst() phase" 379 die "${FUNCNAME}() can be used only in pkg_postinst() phase"
301 fi 380 fi
302 381
382 _python_initialize_prefix_variables
383
303 local pylibdir pymod 384 local pylibdir pymod
304 if [[ -z "${PYTHON_MODNAME}" ]]; then 385 if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
305 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do 386 for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
306 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then 387 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
307 PYTHON_MODNAME="${PN}" 388 PYTHON_MODNAME="${PN}"
308 fi 389 fi
309 done 390 done
310 fi 391 fi
311 392
312 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 393 if [[ -n "${PYTHON_MODNAME}" ]]; then
394 if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
313 python_mod_optimize ${PYTHON_MODNAME} 395 python_mod_optimize ${PYTHON_MODNAME}
314 else 396 else
315 for pymod in ${PYTHON_MODNAME}; do 397 for pymod in ${PYTHON_MODNAME}; do
316 python_mod_optimize "$(python_get_sitedir)/${pymod}" 398 python_mod_optimize "$(python_get_sitedir)/${pymod}"
317 done 399 done
400 fi
318 fi 401 fi
319} 402}
320 403
321# @FUNCTION: distutils_pkg_postrm 404# @FUNCTION: distutils_pkg_postrm
322# @DESCRIPTION: 405# @DESCRIPTION:
327distutils_pkg_postrm() { 410distutils_pkg_postrm() {
328 if [[ "${EBUILD_PHASE}" != "postrm" ]]; then 411 if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
329 die "${FUNCNAME}() can be used only in pkg_postrm() phase" 412 die "${FUNCNAME}() can be used only in pkg_postrm() phase"
330 fi 413 fi
331 414
415 _python_initialize_prefix_variables
416
332 local pylibdir pymod 417 local pylibdir pymod
333 if [[ -z "${PYTHON_MODNAME}" ]]; then 418 if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
334 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do 419 for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
335 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then 420 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
336 PYTHON_MODNAME="${PN}" 421 PYTHON_MODNAME="${PN}"
337 fi 422 fi
338 done 423 done
339 fi 424 fi
340 425
341 if [[ -n "${PYTHON_MODNAME}" ]]; then 426 if [[ -n "${PYTHON_MODNAME}" ]]; then
342 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 427 if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
343 python_mod_cleanup ${PYTHON_MODNAME} 428 python_mod_cleanup ${PYTHON_MODNAME}
344 else 429 else
345 for pymod in ${PYTHON_MODNAME}; do 430 for pymod in ${PYTHON_MODNAME}; do
346 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do 431 for pylibdir in "${EROOT}"usr/$(get_libdir)/python*; do
347 if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then 432 if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then
348 python_mod_cleanup "${pylibdir#${ROOT}}/site-packages/${pymod}" 433 python_mod_cleanup "${pylibdir#${EROOT%/}}/site-packages/${pymod}"
349 fi 434 fi
350 done 435 done
351 done 436 done
352 fi 437 fi
353 else
354 python_mod_cleanup
355 fi 438 fi
356} 439}
357 440
358# @FUNCTION: distutils_python_version 441# Scheduled for deletion on 2011-01-01.
359# @DESCRIPTION:
360# Deprecated wrapper function for deprecated python_version().
361distutils_python_version() { 442distutils_python_version() {
362 if ! has "${EAPI:-0}" 0 1 2; then 443 eerror "Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables."
363 eerror "Use PYTHON() and/or python_get_*() instead of ${FUNCNAME}()." 444 die "${FUNCNAME}() is banned"
364 die "${FUNCNAME}() cannot be used in this EAPI"
365 fi
366
367 python_version
368} 445}
369 446
370# @FUNCTION: distutils_python_tkinter 447# Scheduled for deletion on 2011-01-01.
371# @DESCRIPTION:
372# Deprecated wrapper function for python_tkinter_exists().
373distutils_python_tkinter() { 448distutils_python_tkinter() {
374 if ! has "${EAPI:-0}" 0 1 2; then 449 eerror "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()."
375 eerror "Use python_tkinter_exists() instead of ${FUNCNAME}()." 450 die "${FUNCNAME}() is banned"
376 die "${FUNCNAME}() cannot be used in this EAPI"
377 fi
378
379 python_tkinter_exists
380} 451}

Legend:
Removed from v.1.71  
changed lines
  Added in v.1.78

  ViewVC Help
Powered by ViewVC 1.1.20