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

Diff of /eclass/distutils.eclass

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

Revision 1.76 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.76 2010/07/17 23:03:29 arfrever 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#
68 if [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then 68 if [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
69 IUSE="test" 69 IUSE="test"
70 DEPEND+="${DEPEND:+ }test? ( dev-python/nose )" 70 DEPEND+="${DEPEND:+ }test? ( dev-python/nose )"
71 elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then 71 elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
72 IUSE="test" 72 IUSE="test"
73 DEPEND+="${DEPEND:+ }test? ( dev-python/py )" 73 DEPEND+="${DEPEND:+ }test? ( dev-python/pytest )"
74 # trial requires an argument, which is usually equal to "${PN}". 74 # trial requires an argument, which is usually equal to "${PN}".
75 elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then 75 elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
76 IUSE="test" 76 IUSE="test"
77 DEPEND+="${DEPEND:+ }test? ( dev-python/twisted )" 77 DEPEND+="${DEPEND:+ }test? ( dev-python/twisted )"
78 fi 78 fi
95# @ECLASS-VARIABLE: DOCS 95# @ECLASS-VARIABLE: DOCS
96# @DESCRIPTION: 96# @DESCRIPTION:
97# Additional documentation files installed by distutils_src_install(). 97# Additional documentation files installed by distutils_src_install().
98 98
99_distutils_get_build_dir() { 99_distutils_get_build_dir() {
100 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
101 echo "build-${PYTHON_ABI}" 101 echo "build-${PYTHON_ABI}"
102 else 102 else
103 echo "build" 103 echo "build"
104 fi 104 fi
105} 105}
106 106
107_distutils_get_PYTHONPATH() { 107_distutils_get_PYTHONPATH() {
108 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
109 ls -d build-${PYTHON_ABI}/lib* 2> /dev/null 109 ls -d build-${PYTHON_ABI}/lib* 2> /dev/null
110 else 110 else
111 ls -d build/lib* 2> /dev/null 111 ls -d build/lib* 2> /dev/null
112 fi 112 fi
113} 113}
178 die "${FUNCNAME}() can be used only in src_compile() phase" 178 die "${FUNCNAME}() can be used only in src_compile() phase"
179 fi 179 fi
180 180
181 _python_set_color_variables 181 _python_set_color_variables
182 182
183 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 183 if _python_package_supporting_installation_for_multiple_python_abis; then
184 distutils_building() { 184 distutils_building() {
185 _distutils_hook pre 185 _distutils_hook pre
186 186
187 local setup_file 187 local setup_file
188 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do 188 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
205_distutils_src_test_hook() { 205_distutils_src_test_hook() {
206 if [[ "$#" -ne 1 ]]; then 206 if [[ "$#" -ne 1 ]]; then
207 die "${FUNCNAME}() requires 1 arguments" 207 die "${FUNCNAME}() requires 1 arguments"
208 fi 208 fi
209 209
210 if [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then 210 if ! _python_package_supporting_installation_for_multiple_python_abis; then
211 return 211 return
212 fi 212 fi
213 213
214 if [[ "$(type -t "distutils_src_test_pre_hook")" == "function" ]]; then 214 if [[ "$(type -t "distutils_src_test_pre_hook")" == "function" ]]; then
215 eval "python_execute_$1_pre_hook() { 215 eval "python_execute_$1_pre_hook() {
235 fi 235 fi
236 236
237 _python_set_color_variables 237 _python_set_color_variables
238 238
239 if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then 239 if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then
240 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 240 if _python_package_supporting_installation_for_multiple_python_abis; then
241 distutils_testing() { 241 distutils_testing() {
242 _distutils_hook pre 242 _distutils_hook pre
243 243
244 local setup_file 244 local setup_file
245 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do 245 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
295 fi 295 fi
296 296
297 _python_initialize_prefix_variables 297 _python_initialize_prefix_variables
298 _python_set_color_variables 298 _python_set_color_variables
299 299
300 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 300 if _python_package_supporting_installation_for_multiple_python_abis; then
301 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
302 declare -A wrapper_scripts=() 302 declare -A wrapper_scripts=()
303 303
304 rename_scripts_with_versioned_shebangs() { 304 rename_scripts_with_versioned_shebangs() {
305 if [[ -d "${ED}usr/bin" ]]; then 305 if [[ -d "${ED}usr/bin" ]]; then
306 cd "${ED}usr/bin" 306 cd "${ED}usr/bin"
307 307
308 local nonversioned_file file 308 local nonversioned_file file
309 for file in *; do 309 for file in *; do
310 if [[ -f "${file}" && ! "${file}" =~ [[:digit:]]+\.[[:digit:]](-jython)?+$ && "$(head -n1 "${file}")" =~ ^'#!'.*(python|jython-)[[: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 311 for nonversioned_file in "${DISTUTILS_NONVERSIONED_PYTHON_SCRIPTS[@]}"; do
312 [[ "${nonversioned_file}" == "/usr/bin/${file}" ]] && continue 2 312 [[ "${nonversioned_file}" == "/usr/bin/${file}" ]] && continue 2
313 done 313 done
314 mv "${file}" "${file}-${PYTHON_ABI}" || die "Renaming of '${file}' failed" 314 mv "${file}" "${file}-${PYTHON_ABI}" || die "Renaming of '${file}' failed"
315 wrapper_scripts+=(["${ED}usr/bin/${file}"]=) 315 wrapper_scripts+=(["${ED}usr/bin/${file}"]=)
381 381
382 _python_initialize_prefix_variables 382 _python_initialize_prefix_variables
383 383
384 local pylibdir pymod 384 local pylibdir pymod
385 if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then 385 if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
386 for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"/usr/share/jython-*/Lib; do 386 for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
387 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then 387 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
388 PYTHON_MODNAME="${PN}" 388 PYTHON_MODNAME="${PN}"
389 fi 389 fi
390 done 390 done
391 fi 391 fi
392 392
393 if [[ -n "${PYTHON_MODNAME}" ]]; then 393 if [[ -n "${PYTHON_MODNAME}" ]]; then
394 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 394 if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
395 python_mod_optimize ${PYTHON_MODNAME} 395 python_mod_optimize ${PYTHON_MODNAME}
396 else 396 else
397 for pymod in ${PYTHON_MODNAME}; do 397 for pymod in ${PYTHON_MODNAME}; do
398 python_mod_optimize "$(python_get_sitedir)/${pymod}" 398 python_mod_optimize "$(python_get_sitedir)/${pymod}"
399 done 399 done
414 414
415 _python_initialize_prefix_variables 415 _python_initialize_prefix_variables
416 416
417 local pylibdir pymod 417 local pylibdir pymod
418 if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then 418 if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
419 for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"/usr/share/jython-*/Lib; do 419 for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
420 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then 420 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
421 PYTHON_MODNAME="${PN}" 421 PYTHON_MODNAME="${PN}"
422 fi 422 fi
423 done 423 done
424 fi 424 fi
425 425
426 if [[ -n "${PYTHON_MODNAME}" ]]; then 426 if [[ -n "${PYTHON_MODNAME}" ]]; then
427 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
428 python_mod_cleanup ${PYTHON_MODNAME} 428 python_mod_cleanup ${PYTHON_MODNAME}
429 else 429 else
430 for pymod in ${PYTHON_MODNAME}; do 430 for pymod in ${PYTHON_MODNAME}; do
431 for pylibdir in "${EROOT}"usr/$(get_libdir)/python*; do 431 for pylibdir in "${EROOT}"usr/$(get_libdir)/python*; do
432 if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then 432 if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then

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

  ViewVC Help
Powered by ViewVC 1.1.20