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

Diff of /eclass/python.eclass

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

Revision 1.118 Revision 1.119
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 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/python.eclass,v 1.118 2011/07/08 07:37:49 djc Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.119 2011/07/08 07:39:03 djc Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Gentoo Python Project <python@gentoo.org> 7# Gentoo Python Project <python@gentoo.org>
8# @BLURB: Eclass for Python packages 8# @BLURB: Eclass for Python packages
2594 _python_check_python_pkg_setup_execution 2594 _python_check_python_pkg_setup_execution
2595 _python_initialize_prefix_variables 2595 _python_initialize_prefix_variables
2596 2596
2597 if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then 2597 if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
2598 # PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs. 2598 # PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs.
2599 local allow_evaluated_non_sitedir_paths="0" dir dirs=() evaluated_dirs=() evaluated_files=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=() 2599 local allow_evaluated_non_sitedir_paths="0" dir dirs=() evaluated_dirs=() evaluated_files=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=() stderr stderr_line
2600 2600
2601 if _python_package_supporting_installation_for_multiple_python_abis; then 2601 if _python_package_supporting_installation_for_multiple_python_abis; then
2602 if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then 2602 if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then
2603 die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called" 2603 die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called"
2604 fi 2604 fi
2699 options+=("-q") 2699 options+=("-q")
2700 2700
2701 for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do 2701 for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
2702 if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})) || ((${#evaluated_dirs[@]})) || ((${#evaluated_files[@]})); then 2702 if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})) || ((${#evaluated_dirs[@]})) || ((${#evaluated_files[@]})); then
2703 return_code="0" 2703 return_code="0"
2704 stderr=""
2704 ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)" 2705 ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)"
2705 if ((${#site_packages_dirs[@]})) || ((${#evaluated_dirs[@]})); then 2706 if ((${#site_packages_dirs[@]})) || ((${#evaluated_dirs[@]})); then
2706 for dir in "${site_packages_dirs[@]}"; do 2707 for dir in "${site_packages_dirs[@]}"; do
2707 dirs+=("${root}$(python_get_sitedir)/${dir}") 2708 dirs+=("${root}$(python_get_sitedir)/${dir}")
2708 done 2709 done
2709 for dir in "${evaluated_dirs[@]}"; do 2710 for dir in "${evaluated_dirs[@]}"; do
2710 eval "dirs+=(\"\${root}${dir}\")" 2711 eval "dirs+=(\"\${root}${dir}\")"
2711 done 2712 done
2712 "$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" || return_code="1" 2713 stderr+="${stderr:+$'\n'}$("$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" 2>&1)" || return_code="1"
2713 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2714 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
2714 "$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1" 2715 "$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1"
2715 fi 2716 fi
2716 _python_clean_compiled_modules "${dirs[@]}" 2717 _python_clean_compiled_modules "${dirs[@]}"
2717 fi 2718 fi
2720 files+=("${root}$(python_get_sitedir)/${file}") 2721 files+=("${root}$(python_get_sitedir)/${file}")
2721 done 2722 done
2722 for file in "${evaluated_files[@]}"; do 2723 for file in "${evaluated_files[@]}"; do
2723 eval "files+=(\"\${root}${file}\")" 2724 eval "files+=(\"\${root}${file}\")"
2724 done 2725 done
2725 "$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" || return_code="1" 2726 stderr+="${stderr:+$'\n'}$("$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" 2>&1)" || return_code="1"
2726 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2727 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
2727 "$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" &> /dev/null || return_code="1" 2728 "$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" &> /dev/null || return_code="1"
2728 fi 2729 fi
2729 _python_clean_compiled_modules "${files[@]}" 2730 _python_clean_compiled_modules "${files[@]}"
2730 fi 2731 fi
2731 eend "${return_code}" 2732 eend "${return_code}"
2733 if [[ -n "${stderr}" ]]; then
2734 eerror "Syntax errors / warnings in Python modules for $(python_get_implementation) $(python_get_version):" &> /dev/null
2735 while read stderr_line; do
2736 eerror " ${stderr_line}"
2737 done <<< "${stderr}"
2738 fi
2732 fi 2739 fi
2733 unset dirs files 2740 unset dirs files
2734 done 2741 done
2735 2742
2736 if _python_package_supporting_installation_for_multiple_python_abis; then 2743 if _python_package_supporting_installation_for_multiple_python_abis; then
2742 fi 2749 fi
2743 fi 2750 fi
2744 2751
2745 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then 2752 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then
2746 return_code="0" 2753 return_code="0"
2754 stderr=""
2747 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation) $(python_get_version)" 2755 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation) $(python_get_version)"
2748 if ((${#other_dirs[@]})); then 2756 if ((${#other_dirs[@]})); then
2749 "$(PYTHON ${PYTHON_ABI})" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" || return_code="1" 2757 stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" 2>&1)" || return_code="1"
2750 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2758 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
2751 "$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1" 2759 "$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1"
2752 fi 2760 fi
2753 _python_clean_compiled_modules "${other_dirs[@]}" 2761 _python_clean_compiled_modules "${other_dirs[@]}"
2754 fi 2762 fi
2755 if ((${#other_files[@]})); then 2763 if ((${#other_files[@]})); then
2756 "$(PYTHON ${PYTHON_ABI})" "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" || return_code="1" 2764 stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" 2>&1)" || return_code="1"
2757 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2765 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
2758 "$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1" 2766 "$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1"
2759 fi 2767 fi
2760 _python_clean_compiled_modules "${other_files[@]}" 2768 _python_clean_compiled_modules "${other_files[@]}"
2761 fi 2769 fi
2762 eend "${return_code}" 2770 eend "${return_code}"
2771 if [[ -n "${stderr}" ]]; then
2772 eerror "Syntax errors / warnings in Python modules placed outside of site-packages directories for $(python_get_implementation) $(python_get_version):" &> /dev/null
2773 while read stderr_line; do
2774 eerror " ${stderr_line}"
2775 done <<< "${stderr}"
2776 fi
2763 fi 2777 fi
2764 else 2778 else
2765 # Deprecated part of python_mod_optimize() 2779 # Deprecated part of python_mod_optimize()
2766 ewarn 2780 ewarn
2767 ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation" 2781 ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation"

Legend:
Removed from v.1.118  
changed lines
  Added in v.1.119

  ViewVC Help
Powered by ViewVC 1.1.20