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

Diff of /eclass/python.eclass

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

Revision 1.116 Revision 1.120
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.116 2011/07/04 11:27:53 djc Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.120 2011/07/08 07:40:02 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
21_PYTHON_GLOBALLY_SUPPORTED_ABIS=(${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]} ${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]} ${_JYTHON_GLOBALLY_SUPPORTED_ABIS[@]}) 21_PYTHON_GLOBALLY_SUPPORTED_ABIS=(${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]} ${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]} ${_JYTHON_GLOBALLY_SUPPORTED_ABIS[@]})
22 22
23# ================================================================================================ 23# ================================================================================================
24# ===================================== HANDLING OF METADATA ===================================== 24# ===================================== HANDLING OF METADATA =====================================
25# ================================================================================================ 25# ================================================================================================
26
27_PYTHON_ABI_PATTERN_REGEX="([[:alnum:]]|\.|-|\*|\[|\])+"
26 28
27_python_check_python_abi_matching() { 29_python_check_python_abi_matching() {
28 local pattern patterns patterns_list="0" PYTHON_ABI 30 local pattern patterns patterns_list="0" PYTHON_ABI
29 31
30 while (($#)); do 32 while (($#)); do
706 fi 708 fi
707 709
708 _python_initial_sanity_checks 710 _python_initial_sanity_checks
709 711
710 if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3 4; then 712 if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3 4; then
711 local PYTHON_ABI restricted_ABI restricted_ABIs support_ABI supported_PYTHON_ABIS 713 local PYTHON_ABI
712
713 restricted_ABIs="${RESTRICT_PYTHON_ABIS// /$'\n'}"
714 714
715 if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then 715 if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then
716 local cpython_enabled="0" 716 local cpython_enabled="0"
717 717
718 if [[ -z "${USE_PYTHON}" ]]; then 718 if [[ -z "${USE_PYTHON}" ]]; then
726 726
727 if has "${PYTHON_ABI}" "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; then 727 if has "${PYTHON_ABI}" "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; then
728 cpython_enabled="1" 728 cpython_enabled="1"
729 fi 729 fi
730 730
731 support_ABI="1"
732 while read restricted_ABI; do
733 if _python_check_python_abi_matching "${PYTHON_ABI}" "${restricted_ABI}"; then 731 if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
734 support_ABI="0" 732 export PYTHON_ABIS+="${PYTHON_ABIS:+ }${PYTHON_ABI}"
735 break
736 fi 733 fi
737 done <<< "${restricted_ABIs}"
738 [[ "${support_ABI}" == "1" ]] && export PYTHON_ABIS+="${PYTHON_ABIS:+ }${PYTHON_ABI}"
739 done 734 done
740 735
741 if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then 736 if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then
742 die "USE_PYTHON variable does not enable any Python ABI supported by ${CATEGORY}/${PF}" 737 die "USE_PYTHON variable does not enable any Python ABI supported by ${CATEGORY}/${PF}"
743 fi 738 fi
759 die "'${EPREFIX}/usr/bin/python2' is not valid symlink" 754 die "'${EPREFIX}/usr/bin/python2' is not valid symlink"
760 fi 755 fi
761 756
762 python2_version="$("${EPREFIX}/usr/bin/python2" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')" 757 python2_version="$("${EPREFIX}/usr/bin/python2" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
763 758
759 support_python_major_version="0"
764 for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}"; do 760 for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}"; do
761 if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
765 support_python_major_version="1" 762 support_python_major_version="1"
766 while read restricted_ABI; do 763 break
767 if _python_check_python_abi_matching "${PYTHON_ABI}" "${restricted_ABI}"; then
768 support_python_major_version="0"
769 fi 764 fi
770 done <<< "${restricted_ABIs}"
771 [[ "${support_python_major_version}" == "1" ]] && break
772 done 765 done
773 if [[ "${support_python_major_version}" == "1" ]]; then 766 if [[ "${support_python_major_version}" == "1" ]]; then
774 while read restricted_ABI; do
775 if _python_check_python_abi_matching "${python2_version}" "${restricted_ABI}"; then 767 if _python_check_python_abi_matching --patterns-list "${python2_version}" "${RESTRICT_PYTHON_ABIS}"; then
776 die "Active version of CPython 2 is not supported by ${CATEGORY}/${PF}" 768 die "Active version of CPython 2 is not supported by ${CATEGORY}/${PF}"
777 fi 769 fi
778 done <<< "${restricted_ABIs}"
779 else 770 else
780 python2_version="" 771 python2_version=""
781 fi 772 fi
782 fi 773 fi
783 774
786 die "'${EPREFIX}/usr/bin/python3' is not valid symlink" 777 die "'${EPREFIX}/usr/bin/python3' is not valid symlink"
787 fi 778 fi
788 779
789 python3_version="$("${EPREFIX}/usr/bin/python3" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')" 780 python3_version="$("${EPREFIX}/usr/bin/python3" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
790 781
782 support_python_major_version="0"
791 for PYTHON_ABI in "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do 783 for PYTHON_ABI in "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do
784 if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
792 support_python_major_version="1" 785 support_python_major_version="1"
793 while read restricted_ABI; do 786 break
794 if _python_check_python_abi_matching "${PYTHON_ABI}" "${restricted_ABI}"; then
795 support_python_major_version="0"
796 fi 787 fi
797 done <<< "${restricted_ABIs}"
798 [[ "${support_python_major_version}" == "1" ]] && break
799 done 788 done
800 if [[ "${support_python_major_version}" == "1" ]]; then 789 if [[ "${support_python_major_version}" == "1" ]]; then
801 while read restricted_ABI; do
802 if _python_check_python_abi_matching "${python3_version}" "${restricted_ABI}"; then 790 if _python_check_python_abi_matching --patterns-list "${python3_version}" "${RESTRICT_PYTHON_ABIS}"; then
803 die "Active version of CPython 3 is not supported by ${CATEGORY}/${PF}" 791 die "Active version of CPython 3 is not supported by ${CATEGORY}/${PF}"
804 fi 792 fi
805 done <<< "${restricted_ABIs}"
806 else 793 else
807 python3_version="" 794 python3_version=""
808 fi 795 fi
809 fi 796 fi
810 797
835 eval "_PYTHON_SAVED_${variable}=\"\${!variable}\"" 822 eval "_PYTHON_SAVED_${variable}=\"\${!variable}\""
836 for prefix in PYTHON_USER_ PYTHON_; do 823 for prefix in PYTHON_USER_ PYTHON_; do
837 if [[ "$(declare -p ${prefix}${variable} 2> /dev/null)" == "declare -a ${prefix}${variable}="* ]]; then 824 if [[ "$(declare -p ${prefix}${variable} 2> /dev/null)" == "declare -a ${prefix}${variable}="* ]]; then
838 eval "array=(\"\${${prefix}${variable}[@]}\")" 825 eval "array=(\"\${${prefix}${variable}[@]}\")"
839 for element in "${array[@]}"; do 826 for element in "${array[@]}"; do
840 if [[ "${element}" =~ ^([[:alnum:]]|\.|-|\*|\[|\])+\ (\+|-)\ .+ ]]; then 827 if [[ "${element}" =~ ^${_PYTHON_ABI_PATTERN_REGEX}\ (\+|-)\ .+ ]]; then
841 pattern="${element%% *}" 828 pattern="${element%% *}"
842 element="${element#* }" 829 element="${element#* }"
843 operator="${element%% *}" 830 operator="${element%% *}"
844 flags="${element#* }" 831 flags="${element#* }"
845 if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then 832 if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
2152 die "${FUNCNAME}(): Jython does not have shared library" 2139 die "${FUNCNAME}(): Jython does not have shared library"
2153 fi 2140 fi
2154} 2141}
2155 2142
2156# @FUNCTION: python_get_version 2143# @FUNCTION: python_get_version
2157# @USAGE: [-f|--final-ABI] [--full] [--major] [--minor] [--micro] 2144# @USAGE: [-f|--final-ABI] [-l|--language] [--full] [--major] [--minor] [--micro]
2158# @DESCRIPTION: 2145# @DESCRIPTION:
2159# Print Python version. 2146# Print Python version.
2160# --full, --major, --minor and --micro options cannot be specified simultaneously. 2147# --full, --major, --minor and --micro options cannot be specified simultaneously.
2161# If --full, --major, --minor and --micro options are not specified, then "${major_version}.${minor_version}" is printed. 2148# If --full, --major, --minor and --micro options are not specified, then "${major_version}.${minor_version}" is printed.
2149# If --language option is specified, then Python language version is printed.
2150# --language and --full options cannot be specified simultaneously.
2151# --language and --micro options cannot be specified simultaneously.
2162# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. 2152# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
2163python_get_version() { 2153python_get_version() {
2164 _python_check_python_pkg_setup_execution 2154 _python_check_python_pkg_setup_execution
2165 2155
2166 local final_ABI="0" full="0" major="0" minor="0" micro="0" python_command 2156 local final_ABI="0" language="0" language_version full="0" major="0" minor="0" micro="0" PYTHON_ABI="${PYTHON_ABI}" python_command
2167 2157
2168 while (($#)); do 2158 while (($#)); do
2169 case "$1" in 2159 case "$1" in
2170 -f|--final-ABI) 2160 -f|--final-ABI)
2171 final_ABI="1" 2161 final_ABI="1"
2172 ;; 2162 ;;
2163 -l|--language)
2164 language="1"
2165 ;;
2173 --full) 2166 --full)
2174 full="1" 2167 full="1"
2175 ;; 2168 ;;
2176 --major) 2169 --major)
2177 major="1" 2170 major="1"
2189 die "${FUNCNAME}(): Invalid usage" 2182 die "${FUNCNAME}(): Invalid usage"
2190 ;; 2183 ;;
2191 esac 2184 esac
2192 shift 2185 shift
2193 done 2186 done
2194
2195 if [[ "$((${full} + ${major} + ${minor} + ${micro}))" -gt 1 ]]; then
2196 die "${FUNCNAME}(): '--full', '--major', '--minor' or '--micro' options cannot be specified simultaneously"
2197 fi
2198
2199 if [[ "${full}" == "1" ]]; then
2200 python_command="from sys import version_info; print('.'.join(str(x) for x in version_info[:3]))"
2201 elif [[ "${major}" == "1" ]]; then
2202 python_command="from sys import version_info; print(version_info[0])"
2203 elif [[ "${minor}" == "1" ]]; then
2204 python_command="from sys import version_info; print(version_info[1])"
2205 elif [[ "${micro}" == "1" ]]; then
2206 python_command="from sys import version_info; print(version_info[2])"
2207 else
2208 if [[ -n "${PYTHON_ABI}" && "${final_ABI}" == "0" ]]; then
2209 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
2210 echo "${PYTHON_ABI}"
2211 elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
2212 echo "${PYTHON_ABI%-jython}"
2213 fi
2214 return
2215 fi
2216 python_command="from sys import version_info; print('.'.join(str(x) for x in version_info[:2]))"
2217 fi
2218 2187
2219 if [[ "${final_ABI}" == "1" ]]; then 2188 if [[ "${final_ABI}" == "1" ]]; then
2220 if ! _python_package_supporting_installation_for_multiple_python_abis; then 2189 if ! _python_package_supporting_installation_for_multiple_python_abis; then
2221 die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" 2190 die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
2222 fi 2191 fi
2223 "$(PYTHON -f)" -c "${python_command}"
2224 else 2192 else
2225 if _python_package_supporting_installation_for_multiple_python_abis && ! _python_abi-specific_local_scope; then 2193 if _python_package_supporting_installation_for_multiple_python_abis && ! _python_abi-specific_local_scope; then
2226 die "${FUNCNAME}() should be used in ABI-specific local scope" 2194 die "${FUNCNAME}() should be used in ABI-specific local scope"
2227 fi 2195 fi
2196 fi
2197
2198 if [[ "$((${full} + ${major} + ${minor} + ${micro}))" -gt 1 ]]; then
2199 die "${FUNCNAME}(): '--full', '--major', '--minor' or '--micro' options cannot be specified simultaneously"
2200 fi
2201
2202 if [[ "${language}" == "1" ]]; then
2203 if [[ "${final_ABI}" == "1" ]]; then
2204 PYTHON_ABI="$(PYTHON -f --ABI)"
2205 elif [[ -z "${PYTHON_ABI}" ]]; then
2206 PYTHON_ABI="$(PYTHON --ABI)"
2207 fi
2208 language_version="${PYTHON_ABI%%-*}"
2209 if [[ "${full}" == "1" ]]; then
2210 die "${FUNCNAME}(): '--language' and '--full' options cannot be specified simultaneously"
2211 elif [[ "${major}" == "1" ]]; then
2212 echo "${language_version%.*}"
2213 elif [[ "${minor}" == "1" ]]; then
2214 echo "${language_version#*.}"
2215 elif [[ "${micro}" == "1" ]]; then
2216 die "${FUNCNAME}(): '--language' and '--micro' options cannot be specified simultaneously"
2217 else
2218 echo "${language_version}"
2219 fi
2220 else
2221 if [[ "${full}" == "1" ]]; then
2222 python_command="from sys import version_info; print('.'.join(str(x) for x in version_info[:3]))"
2223 elif [[ "${major}" == "1" ]]; then
2224 python_command="from sys import version_info; print(version_info[0])"
2225 elif [[ "${minor}" == "1" ]]; then
2226 python_command="from sys import version_info; print(version_info[1])"
2227 elif [[ "${micro}" == "1" ]]; then
2228 python_command="from sys import version_info; print(version_info[2])"
2229 else
2230 if [[ -n "${PYTHON_ABI}" && "${final_ABI}" == "0" ]]; then
2231 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
2232 echo "${PYTHON_ABI}"
2233 elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
2234 echo "${PYTHON_ABI%-jython}"
2235 fi
2236 return
2237 fi
2238 python_command="from sys import version_info; print('.'.join(str(x) for x in version_info[:2]))"
2239 fi
2240
2241 if [[ "${final_ABI}" == "1" ]]; then
2242 "$(PYTHON -f)" -c "${python_command}"
2243 else
2228 "$(PYTHON ${PYTHON_ABI})" -c "${python_command}" 2244 "$(PYTHON ${PYTHON_ABI})" -c "${python_command}"
2245 fi
2229 fi 2246 fi
2230} 2247}
2231 2248
2232# ================================================================================================ 2249# ================================================================================================
2233# ================================ FUNCTIONS FOR RUNNING OF TESTS ================================ 2250# ================================ FUNCTIONS FOR RUNNING OF TESTS ================================
2579 _python_check_python_pkg_setup_execution 2596 _python_check_python_pkg_setup_execution
2580 _python_initialize_prefix_variables 2597 _python_initialize_prefix_variables
2581 2598
2582 if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then 2599 if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
2583 # PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs. 2600 # PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs.
2584 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=() 2601 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
2585 2602
2586 if _python_package_supporting_installation_for_multiple_python_abis; then 2603 if _python_package_supporting_installation_for_multiple_python_abis; then
2587 if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then 2604 if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then
2588 die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called" 2605 die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called"
2589 fi 2606 fi
2684 options+=("-q") 2701 options+=("-q")
2685 2702
2686 for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do 2703 for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
2687 if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})) || ((${#evaluated_dirs[@]})) || ((${#evaluated_files[@]})); then 2704 if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})) || ((${#evaluated_dirs[@]})) || ((${#evaluated_files[@]})); then
2688 return_code="0" 2705 return_code="0"
2706 stderr=""
2689 ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)" 2707 ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)"
2690 if ((${#site_packages_dirs[@]})) || ((${#evaluated_dirs[@]})); then 2708 if ((${#site_packages_dirs[@]})) || ((${#evaluated_dirs[@]})); then
2691 for dir in "${site_packages_dirs[@]}"; do 2709 for dir in "${site_packages_dirs[@]}"; do
2692 dirs+=("${root}$(python_get_sitedir)/${dir}") 2710 dirs+=("${root}$(python_get_sitedir)/${dir}")
2693 done 2711 done
2694 for dir in "${evaluated_dirs[@]}"; do 2712 for dir in "${evaluated_dirs[@]}"; do
2695 eval "dirs+=(\"\${root}${dir}\")" 2713 eval "dirs+=(\"\${root}${dir}\")"
2696 done 2714 done
2697 "$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" || return_code="1" 2715 stderr+="${stderr:+$'\n'}$("$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" 2>&1)" || return_code="1"
2698 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2716 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
2699 "$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1" 2717 "$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1"
2700 fi 2718 fi
2701 _python_clean_compiled_modules "${dirs[@]}" 2719 _python_clean_compiled_modules "${dirs[@]}"
2702 fi 2720 fi
2705 files+=("${root}$(python_get_sitedir)/${file}") 2723 files+=("${root}$(python_get_sitedir)/${file}")
2706 done 2724 done
2707 for file in "${evaluated_files[@]}"; do 2725 for file in "${evaluated_files[@]}"; do
2708 eval "files+=(\"\${root}${file}\")" 2726 eval "files+=(\"\${root}${file}\")"
2709 done 2727 done
2710 "$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" || return_code="1" 2728 stderr+="${stderr:+$'\n'}$("$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" 2>&1)" || return_code="1"
2711 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2729 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
2712 "$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" &> /dev/null || return_code="1" 2730 "$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" &> /dev/null || return_code="1"
2713 fi 2731 fi
2714 _python_clean_compiled_modules "${files[@]}" 2732 _python_clean_compiled_modules "${files[@]}"
2715 fi 2733 fi
2716 eend "${return_code}" 2734 eend "${return_code}"
2735 if [[ -n "${stderr}" ]]; then
2736 eerror "Syntax errors / warnings in Python modules for $(python_get_implementation) $(python_get_version):" &> /dev/null
2737 while read stderr_line; do
2738 eerror " ${stderr_line}"
2739 done <<< "${stderr}"
2740 fi
2717 fi 2741 fi
2718 unset dirs files 2742 unset dirs files
2719 done 2743 done
2720 2744
2721 if _python_package_supporting_installation_for_multiple_python_abis; then 2745 if _python_package_supporting_installation_for_multiple_python_abis; then
2727 fi 2751 fi
2728 fi 2752 fi
2729 2753
2730 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then 2754 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then
2731 return_code="0" 2755 return_code="0"
2756 stderr=""
2732 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation) $(python_get_version)" 2757 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation) $(python_get_version)"
2733 if ((${#other_dirs[@]})); then 2758 if ((${#other_dirs[@]})); then
2734 "$(PYTHON ${PYTHON_ABI})" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" || return_code="1" 2759 stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" 2>&1)" || return_code="1"
2735 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2760 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
2736 "$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1" 2761 "$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1"
2737 fi 2762 fi
2738 _python_clean_compiled_modules "${other_dirs[@]}" 2763 _python_clean_compiled_modules "${other_dirs[@]}"
2739 fi 2764 fi
2740 if ((${#other_files[@]})); then 2765 if ((${#other_files[@]})); then
2741 "$(PYTHON ${PYTHON_ABI})" "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" || return_code="1" 2766 stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" 2>&1)" || return_code="1"
2742 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2767 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
2743 "$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1" 2768 "$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1"
2744 fi 2769 fi
2745 _python_clean_compiled_modules "${other_files[@]}" 2770 _python_clean_compiled_modules "${other_files[@]}"
2746 fi 2771 fi
2747 eend "${return_code}" 2772 eend "${return_code}"
2773 if [[ -n "${stderr}" ]]; then
2774 eerror "Syntax errors / warnings in Python modules placed outside of site-packages directories for $(python_get_implementation) $(python_get_version):" &> /dev/null
2775 while read stderr_line; do
2776 eerror " ${stderr_line}"
2777 done <<< "${stderr}"
2778 fi
2748 fi 2779 fi
2749 else 2780 else
2750 # Deprecated part of python_mod_optimize() 2781 # Deprecated part of python_mod_optimize()
2751 ewarn 2782 ewarn
2752 ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation" 2783 ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation"

Legend:
Removed from v.1.116  
changed lines
  Added in v.1.120

  ViewVC Help
Powered by ViewVC 1.1.20