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

Diff of /eclass/distutils.eclass

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

Revision 1.75 Revision 1.76
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.75 2010/05/25 15:07:04 arfrever Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.76 2010/07/17 23:03:29 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#
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.
178 182
179 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 183 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
180 distutils_building() { 184 distutils_building() {
181 _distutils_hook pre 185 _distutils_hook pre
182 186
187 local setup_file
188 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
183 echo ${_BOLD}"$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL} 189 echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL}
184 "$(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
185 192
186 _distutils_hook post 193 _distutils_hook post
187 } 194 }
188 python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@" 195 python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@"
189 else 196 else
197 local setup_file
198 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
190 echo ${_BOLD}"$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"${_NORMAL} 199 echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"${_NORMAL}
191 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed" 200 "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
201 done
192 fi 202 fi
193} 203}
194 204
195_distutils_src_test_hook() { 205_distutils_src_test_hook() {
196 if [[ "$#" -ne 1 ]]; then 206 if [[ "$#" -ne 1 ]]; then
229 if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then 239 if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then
230 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 240 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
231 distutils_testing() { 241 distutils_testing() {
232 _distutils_hook pre 242 _distutils_hook pre
233 243
244 local setup_file
245 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
234 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} 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}
235 PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@" || return "$?" 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
236 249
237 _distutils_hook post 250 _distutils_hook post
238 } 251 }
239 python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@" 252 python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@"
240 else 253 else
254 local setup_file
255 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
241 echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL} 256 echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL}
242 PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" 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
243 fi 259 fi
244 elif [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then 260 elif [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
245 _distutils_src_test_hook nosetests 261 _distutils_src_test_hook nosetests
246 262
247 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} -- "$@"
304 fi 320 fi
305 321
306 distutils_installation() { 322 distutils_installation() {
307 _distutils_hook pre 323 _distutils_hook pre
308 324
325 local setup_file
326 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
309 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} 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}
310 "$(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
311 330
312 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
313 rename_scripts_with_versioned_shebangs 332 rename_scripts_with_versioned_shebangs
314 fi 333 fi
315 334
323 unset wrapper_scripts 342 unset wrapper_scripts
324 else 343 else
325 # Mark the package to be rebuilt after a Python upgrade. 344 # Mark the package to be rebuilt after a Python upgrade.
326 python_need_rebuild 345 python_need_rebuild
327 346
347 local setup_file
348 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
328 echo ${_BOLD}"$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"${_NORMAL} 349 echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"${_NORMAL}
329 "$(PYTHON)" 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
330 fi 352 fi
331 353
332 if [[ -e "${ED}usr/local" ]]; then 354 if [[ -e "${ED}usr/local" ]]; then
333 die "Illegal installation into /usr/local" 355 die "Illegal installation into /usr/local"
334 fi 356 fi
414 done 436 done
415 fi 437 fi
416 fi 438 fi
417} 439}
418 440
419# @FUNCTION: distutils_python_version 441# Scheduled for deletion on 2011-01-01.
420# @DESCRIPTION:
421# Deprecated wrapper function for deprecated python_version().
422distutils_python_version() { 442distutils_python_version() {
423 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
424 eerror "Use PYTHON() and/or python_get_*() instead of ${FUNCNAME}()."
425 die "${FUNCNAME}() cannot be used in this EAPI"
426 fi
427
428 _python_set_color_variables
429
430 eerror
431 eerror "${_RED}Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01.${_NORMAL}"
432 eerror "${_RED}Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables.${_NORMAL}" 443 eerror "Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables."
433 eerror 444 die "${FUNCNAME}() is banned"
434
435 python_version
436} 445}
437 446
438# @FUNCTION: distutils_python_tkinter 447# Scheduled for deletion on 2011-01-01.
439# @DESCRIPTION:
440# Deprecated wrapper function for deprecated python_tkinter_exists().
441distutils_python_tkinter() { 448distutils_python_tkinter() {
442 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
443 eerror "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()." 449 eerror "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()."
444 die "${FUNCNAME}() cannot be used in this EAPI" 450 die "${FUNCNAME}() is banned"
445 fi
446
447 _python_set_color_variables
448
449 eerror
450 eerror "${_RED}Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01.${_NORMAL}"
451 eerror "${_RED}Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}().${_NORMAL}"
452 eerror
453
454 python_tkinter_exists
455} 451}

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

  ViewVC Help
Powered by ViewVC 1.1.20