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

Diff of /eclass/python.eclass

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

Revision 1.136 Revision 1.139
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.136 2011/10/07 10:53:14 djc Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.139 2011/10/15 20:58:08 phajdan.jr 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
9# @DESCRIPTION: 9# @DESCRIPTION:
10# The python eclass contains miscellaneous, useful functions for Python packages. 10# The python eclass contains miscellaneous, useful functions for Python packages.
11 11
12inherit multilib 12inherit multilib
13 13
14if ! has "${EAPI:-0}" 0 1 2 3; then 14if ! has "${EAPI:-0}" 0 1 2 3 4; then
15 die "API of python.eclass in EAPI=\"${EAPI}\" not established" 15 die "API of python.eclass in EAPI=\"${EAPI}\" not established"
16fi 16fi
17 17
18_CPYTHON2_GLOBALLY_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7) 18_CPYTHON2_GLOBALLY_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7)
19_CPYTHON3_GLOBALLY_SUPPORTED_ABIS=(3.1 3.2) 19_CPYTHON3_GLOBALLY_SUPPORTED_ABIS=(3.1 3.2)
1621 stdout = sys.stdout.buffer 1621 stdout = sys.stdout.buffer
1622else: 1622else:
1623 # Python 2 1623 # Python 2
1624 stdout = sys.stdout 1624 stdout = sys.stdout
1625 1625
1626python_wrapper_scripts_file = open('${T}/python_wrapper_scripts', 'rb')
1626files = set(open('${T}/python_wrapper_scripts', 'rb').read().rstrip(${b}'\x00').split(${b}'\x00')) 1627files = set(python_wrapper_scripts_file.read().rstrip(${b}'\x00').split(${b}'\x00'))
1628python_wrapper_scripts_file.close()
1627 1629
1628for file in sorted(files): 1630for file in sorted(files):
1629 stdout.write(file) 1631 stdout.write(file)
1630 stdout.write(${b}'\x00')" || die "${FUNCNAME}(): Failure of extraction of set of wrapper scripts") 1632 stdout.write(${b}'\x00')" || die "${FUNCNAME}(): Failure of extraction of set of wrapper scripts")
1631 1633
2858 done 2860 done
2859 for dir in "${evaluated_dirs[@]}"; do 2861 for dir in "${evaluated_dirs[@]}"; do
2860 eval "dirs+=(\"\${root}${dir}\")" 2862 eval "dirs+=(\"\${root}${dir}\")"
2861 done 2863 done
2862 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"
2863 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2865 if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
2864 "$(PYTHON)" -O -m compileall "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1" 2866 "$(PYTHON)" -O -m compileall "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1"
2865 fi 2867 fi
2866 _python_clean_compiled_modules "${dirs[@]}" 2868 _python_clean_compiled_modules "${dirs[@]}"
2867 fi 2869 fi
2868 if ((${#site_packages_files[@]})) || ((${#evaluated_files[@]})); then 2870 if ((${#site_packages_files[@]})) || ((${#evaluated_files[@]})); then
2871 done 2873 done
2872 for file in "${evaluated_files[@]}"; do 2874 for file in "${evaluated_files[@]}"; do
2873 eval "files+=(\"\${root}${file}\")" 2875 eval "files+=(\"\${root}${file}\")"
2874 done 2876 done
2875 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"
2876 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2878 if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
2877 "$(PYTHON)" -O -m py_compile "${files[@]}" &> /dev/null || return_code="1" 2879 "$(PYTHON)" -O -m py_compile "${files[@]}" &> /dev/null || return_code="1"
2878 fi 2880 fi
2879 _python_clean_compiled_modules "${files[@]}" 2881 _python_clean_compiled_modules "${files[@]}"
2880 fi 2882 fi
2881 eend "${return_code}" 2883 eend "${return_code}"
2902 return_code="0" 2904 return_code="0"
2903 stderr="" 2905 stderr=""
2904 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)"
2905 if ((${#other_dirs[@]})); then 2907 if ((${#other_dirs[@]})); then
2906 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"
2907 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2909 if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
2908 "$(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"
2909 fi 2911 fi
2910 _python_clean_compiled_modules "${other_dirs[@]}" 2912 _python_clean_compiled_modules "${other_dirs[@]}"
2911 fi 2913 fi
2912 if ((${#other_files[@]})); then 2914 if ((${#other_files[@]})); then
2913 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"
2914 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2916 if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
2915 "$(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"
2916 fi 2918 fi
2917 _python_clean_compiled_modules "${other_files[@]}" 2919 _python_clean_compiled_modules "${other_files[@]}"
2918 fi 2920 fi
2919 eend "${return_code}" 2921 eend "${return_code}"

Legend:
Removed from v.1.136  
changed lines
  Added in v.1.139

  ViewVC Help
Powered by ViewVC 1.1.20