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

Diff of /eclass/python.eclass

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

Revision 1.88 Revision 1.89
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/python.eclass,v 1.88 2010/02/11 18:52:44 arfrever Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.89 2010/02/14 18:53:11 arfrever 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
150 else 150 else
151 die "Invalid syntax of PYTHON_DEPEND" 151 die "Invalid syntax of PYTHON_DEPEND"
152 fi 152 fi
153} 153}
154 154
155DEPEND=">=app-admin/eselect-python-20090804" 155DEPEND=">=app-admin/eselect-python-20091230"
156RDEPEND="${DEPEND}" 156RDEPEND="${DEPEND}"
157 157
158if [[ -n "${PYTHON_DEPEND}" && -n "${NEED_PYTHON}" ]]; then 158if [[ -n "${PYTHON_DEPEND}" && -n "${NEED_PYTHON}" ]]; then
159 die "PYTHON_DEPEND and NEED_PYTHON cannot be set simultaneously" 159 die "PYTHON_DEPEND and NEED_PYTHON cannot be set simultaneously"
160elif [[ -n "${PYTHON_DEPEND}" ]]; then 160elif [[ -n "${PYTHON_DEPEND}" ]]; then
888 die "${FUNCNAME}(): Generation of '$1' failed" 888 die "${FUNCNAME}(): Generation of '$1' failed"
889 fi 889 fi
890 fi 890 fi
891 cat << EOF >> "${file}" 891 cat << EOF >> "${file}"
892 892
893os.environ["PYTHON_PROCESS_NAME"] = sys.argv[0] 893os.environ["PYTHON_SCRIPT_NAME"] = sys.argv[0]
894target_executable = "%s-%s" % (os.path.realpath(sys.argv[0]), PYTHON_ABI) 894target_executable = "%s-%s" % (os.path.realpath(sys.argv[0]), PYTHON_ABI)
895if not os.path.exists(target_executable): 895if not os.path.exists(target_executable):
896 sys.stderr.write("'%s' does not exist\n" % target_executable) 896 sys.stderr.write("'%s' does not exist\n" % target_executable)
897 sys.exit(1) 897 sys.exit(1)
898 898
1052 die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple versions of Python" 1052 die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple versions of Python"
1053 fi 1053 fi
1054 validate_PYTHON_ABIS 1054 validate_PYTHON_ABIS
1055 PYTHON_ABI="${PYTHON_ABIS##* }" 1055 PYTHON_ABI="${PYTHON_ABIS##* }"
1056 elif [[ "${python2}" == "1" ]]; then 1056 elif [[ "${python2}" == "1" ]]; then
1057 # PYTHON_ABI="$(eselect python show --python2 --ABI)" 1057 PYTHON_ABI="$(eselect python show --python2 --ABI)"
1058 PYTHON_ABI="$(eselect python show --python2)"
1059 if [[ -z "${PYTHON_ABI}" ]]; then 1058 if [[ -z "${PYTHON_ABI}" ]]; then
1060 die "${FUNCNAME}(): Active Python 2 interpreter not set" 1059 die "${FUNCNAME}(): Active Python 2 interpreter not set"
1061 elif [[ "${PYTHON_ABI}" != "python2."* ]]; then 1060 elif [[ "${PYTHON_ABI}" != "2."* ]]; then
1062 die "${FUNCNAME}(): Internal error in \`eselect python show --python2\`" 1061 die "${FUNCNAME}(): Internal error in \`eselect python show --python2\`"
1063 fi 1062 fi
1064 PYTHON_ABI="${PYTHON_ABI#python}"
1065 elif [[ "${python3}" == "1" ]]; then 1063 elif [[ "${python3}" == "1" ]]; then
1066 # PYTHON_ABI="$(eselect python show --python3 --ABI)" 1064 PYTHON_ABI="$(eselect python show --python3 --ABI)"
1067 PYTHON_ABI="$(eselect python show --python3)"
1068 if [[ -z "${PYTHON_ABI}" ]]; then 1065 if [[ -z "${PYTHON_ABI}" ]]; then
1069 die "${FUNCNAME}(): Active Python 3 interpreter not set" 1066 die "${FUNCNAME}(): Active Python 3 interpreter not set"
1070 elif [[ "${PYTHON_ABI}" != "python3."* ]]; then 1067 elif [[ "${PYTHON_ABI}" != "3."* ]]; then
1071 die "${FUNCNAME}(): Internal error in \`eselect python show --python3\`" 1068 die "${FUNCNAME}(): Internal error in \`eselect python show --python3\`"
1072 fi 1069 fi
1073 PYTHON_ABI="${PYTHON_ABI#python}"
1074 elif [[ -z "${PYTHON_ABI}" ]]; then 1070 elif [[ -z "${PYTHON_ABI}" ]]; then
1075 die "${FUNCNAME}(): Invalid usage: Python ABI not specified" 1071 die "${FUNCNAME}(): Invalid usage: Python ABI not specified"
1076 fi 1072 fi
1077 elif [[ "$#" -eq 1 ]]; then 1073 elif [[ "$#" -eq 1 ]]; then
1078 if [[ "${active}" == "1" ]]; then 1074 if [[ "${active}" == "1" ]]; then
1837 unset PYTHON_ABI 1833 unset PYTHON_ABI
1838 fi 1834 fi
1839 1835
1840 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then 1836 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then
1841 return_code="0" 1837 return_code="0"
1842 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for Python $(PYTHON -A --ABI)" 1838 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation) $(python_get_version)"
1843 if ((${#other_dirs[@]})); then 1839 if ((${#other_dirs[@]})); then
1844 "$(PYTHON "${PYTHON_ABI--A}")" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" || return_code="1" 1840 "$(PYTHON "${PYTHON_ABI--A}")" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" || return_code="1"
1845 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 1841 if [[ "$(_python_get_implementation "${PYTHON_ABI-$(PYTHON -A --ABI)}")" != "Jython" ]]; then
1846 "$(PYTHON "${PYTHON_ABI--A}")" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1" 1842 "$(PYTHON "${PYTHON_ABI--A}")" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1"
1847 fi 1843 fi
1848 fi 1844 fi
1849 if ((${#other_files[@]})); then 1845 if ((${#other_files[@]})); then
1850 "$(PYTHON "${PYTHON_ABI--A}")" "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" || return_code="1" 1846 "$(PYTHON "${PYTHON_ABI--A}")" "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" || return_code="1"
1851 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 1847 if [[ "$(_python_get_implementation "${PYTHON_ABI-$(PYTHON -A --ABI)}")" != "Jython" ]]; then
1852 "$(PYTHON "${PYTHON_ABI--A}")" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1" 1848 "$(PYTHON "${PYTHON_ABI--A}")" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1"
1853 fi 1849 fi
1854 fi 1850 fi
1855 eend "${return_code}" 1851 eend "${return_code}"
1856 fi 1852 fi
1890 done 1886 done
1891 1887
1892 # set additional opts 1888 # set additional opts
1893 myopts+=(-q) 1889 myopts+=(-q)
1894 1890
1895 ebegin "Compilation and optimization of Python modules for Python $(PYTHON -A --ABI)" 1891 ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)"
1896 if ((${#mydirs[@]})); then 1892 if ((${#mydirs[@]})); then
1897 "$(PYTHON "${PYTHON_ABI--A}")" "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" || return_code="1" 1893 "$(PYTHON "${PYTHON_ABI--A}")" "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" || return_code="1"
1898 "$(PYTHON "${PYTHON_ABI--A}")" -O "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" &> /dev/null || return_code="1" 1894 "$(PYTHON "${PYTHON_ABI--A}")" -O "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" &> /dev/null || return_code="1"
1899 fi 1895 fi
1900 1896

Legend:
Removed from v.1.88  
changed lines
  Added in v.1.89

  ViewVC Help
Powered by ViewVC 1.1.20