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.137 2011/10/07 10:55:51 djc Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.138 2011/10/07 10:57:48 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 |
… | |
… | |
2860 | done |
2860 | done |
2861 | for dir in "${evaluated_dirs[@]}"; do |
2861 | for dir in "${evaluated_dirs[@]}"; do |
2862 | eval "dirs+=(\"\${root}${dir}\")" |
2862 | eval "dirs+=(\"\${root}${dir}\")" |
2863 | done |
2863 | done |
2864 | stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m compileall "${options[@]}" "${dirs[@]}" 2>&1)" || return_code="1" |
2864 | stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m compileall "${options[@]}" "${dirs[@]}" 2>&1)" || return_code="1" |
2865 | if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then |
2865 | if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then |
2866 | "$(PYTHON)" -O -m compileall "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1" |
2866 | "$(PYTHON)" -O -m compileall "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1" |
2867 | fi |
2867 | fi |
2868 | _python_clean_compiled_modules "${dirs[@]}" |
2868 | _python_clean_compiled_modules "${dirs[@]}" |
2869 | fi |
2869 | fi |
2870 | if ((${#site_packages_files[@]})) || ((${#evaluated_files[@]})); then |
2870 | if ((${#site_packages_files[@]})) || ((${#evaluated_files[@]})); then |
… | |
… | |
2873 | done |
2873 | done |
2874 | for file in "${evaluated_files[@]}"; do |
2874 | for file in "${evaluated_files[@]}"; do |
2875 | eval "files+=(\"\${root}${file}\")" |
2875 | eval "files+=(\"\${root}${file}\")" |
2876 | done |
2876 | done |
2877 | stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m py_compile "${files[@]}" 2>&1)" || return_code="1" |
2877 | stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m py_compile "${files[@]}" 2>&1)" || return_code="1" |
2878 | if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then |
2878 | if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then |
2879 | "$(PYTHON)" -O -m py_compile "${files[@]}" &> /dev/null || return_code="1" |
2879 | "$(PYTHON)" -O -m py_compile "${files[@]}" &> /dev/null || return_code="1" |
2880 | fi |
2880 | fi |
2881 | _python_clean_compiled_modules "${files[@]}" |
2881 | _python_clean_compiled_modules "${files[@]}" |
2882 | fi |
2882 | fi |
2883 | eend "${return_code}" |
2883 | eend "${return_code}" |
… | |
… | |
2904 | return_code="0" |
2904 | return_code="0" |
2905 | stderr="" |
2905 | stderr="" |
2906 | ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation_and_version)" |
2906 | ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation_and_version)" |
2907 | if ((${#other_dirs[@]})); then |
2907 | if ((${#other_dirs[@]})); then |
2908 | stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m compileall "${options[@]}" "${other_dirs[@]}" 2>&1)" || return_code="1" |
2908 | stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m compileall "${options[@]}" "${other_dirs[@]}" 2>&1)" || return_code="1" |
2909 | if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then |
2909 | if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then |
2910 | "$(PYTHON ${PYTHON_ABI})" -O -m compileall "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1" |
2910 | "$(PYTHON ${PYTHON_ABI})" -O -m compileall "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1" |
2911 | fi |
2911 | fi |
2912 | _python_clean_compiled_modules "${other_dirs[@]}" |
2912 | _python_clean_compiled_modules "${other_dirs[@]}" |
2913 | fi |
2913 | fi |
2914 | if ((${#other_files[@]})); then |
2914 | if ((${#other_files[@]})); then |
2915 | stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m py_compile "${other_files[@]}" 2>&1)" || return_code="1" |
2915 | stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m py_compile "${other_files[@]}" 2>&1)" || return_code="1" |
2916 | if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then |
2916 | if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then |
2917 | "$(PYTHON ${PYTHON_ABI})" -O -m py_compile "${other_files[@]}" &> /dev/null || return_code="1" |
2917 | "$(PYTHON ${PYTHON_ABI})" -O -m py_compile "${other_files[@]}" &> /dev/null || return_code="1" |
2918 | fi |
2918 | fi |
2919 | _python_clean_compiled_modules "${other_files[@]}" |
2919 | _python_clean_compiled_modules "${other_files[@]}" |
2920 | fi |
2920 | fi |
2921 | eend "${return_code}" |
2921 | eend "${return_code}" |