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

Diff of /eclass/python.eclass

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

Revision 1.153 Revision 1.156
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 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.153 2012/03/20 20:37:21 floppym Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.156 2012/08/16 07:46:15 patrick 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
28fi 28fi
29 29
30_CPYTHON2_GLOBALLY_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7) 30_CPYTHON2_GLOBALLY_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7)
31_CPYTHON3_GLOBALLY_SUPPORTED_ABIS=(3.1 3.2) 31_CPYTHON3_GLOBALLY_SUPPORTED_ABIS=(3.1 3.2)
32_JYTHON_GLOBALLY_SUPPORTED_ABIS=(2.5-jython) 32_JYTHON_GLOBALLY_SUPPORTED_ABIS=(2.5-jython)
33_PYPY_GLOBALLY_SUPPORTED_ABIS=(2.7-pypy-1.7 2.7-pypy-1.8) 33_PYPY_GLOBALLY_SUPPORTED_ABIS=(2.7-pypy-1.7 2.7-pypy-1.8 2.7-pypy-1.9)
34_PYTHON_GLOBALLY_SUPPORTED_ABIS=(${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]} ${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]} ${_JYTHON_GLOBALLY_SUPPORTED_ABIS[@]} ${_PYPY_GLOBALLY_SUPPORTED_ABIS[@]}) 34_PYTHON_GLOBALLY_SUPPORTED_ABIS=(${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]} ${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]} ${_JYTHON_GLOBALLY_SUPPORTED_ABIS[@]} ${_PYPY_GLOBALLY_SUPPORTED_ABIS[@]})
35 35
36# ================================================================================================ 36# ================================================================================================
37# ===================================== HANDLING OF METADATA ===================================== 37# ===================================== HANDLING OF METADATA =====================================
38# ================================================================================================ 38# ================================================================================================
1305cpython_shebang_re = re.compile(r"^#![ \t]*(?:${EPREFIX}/usr/bin/python|(?:${EPREFIX})?/usr/bin/env[ \t]+(?:${EPREFIX}/usr/bin/)?python)") 1305cpython_shebang_re = re.compile(r"^#![ \t]*(?:${EPREFIX}/usr/bin/python|(?:${EPREFIX})?/usr/bin/env[ \t]+(?:${EPREFIX}/usr/bin/)?python)")
1306python_shebang_options_re = re.compile(r"^#![ \t]*${EPREFIX}/usr/bin/(?:jython|pypy-c|python)(?:\d+(?:\.\d+)?)?[ \t]+(-\S)") 1306python_shebang_options_re = re.compile(r"^#![ \t]*${EPREFIX}/usr/bin/(?:jython|pypy-c|python)(?:\d+(?:\.\d+)?)?[ \t]+(-\S)")
1307python_verification_output_re = re.compile("^GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n$") 1307python_verification_output_re = re.compile("^GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n$")
1308 1308
1309pypy_versions_mapping = { 1309pypy_versions_mapping = {
1310 "1.5": "2.7" 1310 "1.5": "2.7",
1311 "1.6": "2.7",
1312 "1.7": "2.7",
1313 "1.8": "2.7",
1314 "1.9": "2.7",
1311} 1315}
1312 1316
1313def get_PYTHON_ABI(python_interpreter): 1317def get_PYTHON_ABI(python_interpreter):
1314 cpython_matched = cpython_interpreter_re.match(python_interpreter) 1318 cpython_matched = cpython_interpreter_re.match(python_interpreter)
1315 jython_matched = jython_interpreter_re.match(python_interpreter) 1319 jython_matched = jython_interpreter_re.match(python_interpreter)
2762 if [[ "${EBUILD_PHASE}" == "postinst" ]]; then 2766 if [[ "${EBUILD_PHASE}" == "postinst" ]]; then
2763 [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue 2767 [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue
2764 else 2768 else
2765 [[ -f "${py_file}" ]] && continue 2769 [[ -f "${py_file}" ]] && continue
2766 fi 2770 fi
2767 echo "${_BLUE}<<< ${compiled_file%[co]}[co]${_NORMAL}"
2768 rm -f "${compiled_file%[co]}"[co] 2771 rm -f "${compiled_file%[co]}"[co]
2769 elif [[ "${compiled_file}" == *\$py.class ]]; then 2772 elif [[ "${compiled_file}" == *\$py.class ]]; then
2770 if [[ "${dir}" == "__pycache__" ]]; then 2773 if [[ "${dir}" == "__pycache__" ]]; then
2771 base_module_name="${compiled_file##*/}" 2774 base_module_name="${compiled_file##*/}"
2772 base_module_name="${base_module_name%\$py.class}" 2775 base_module_name="${base_module_name%\$py.class}"
2777 if [[ "${EBUILD_PHASE}" == "postinst" ]]; then 2780 if [[ "${EBUILD_PHASE}" == "postinst" ]]; then
2778 [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue 2781 [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue
2779 else 2782 else
2780 [[ -f "${py_file}" ]] && continue 2783 [[ -f "${py_file}" ]] && continue
2781 fi 2784 fi
2782 echo "${_BLUE}<<< ${compiled_file}${_NORMAL}"
2783 rm -f "${compiled_file}" 2785 rm -f "${compiled_file}"
2784 else 2786 else
2785 die "${FUNCNAME}(): Unrecognized file type: '${compiled_file}'" 2787 die "${FUNCNAME}(): Unrecognized file type: '${compiled_file}'"
2786 fi 2788 fi
2787 2789
2788 # Delete empty parent directories. 2790 # Delete empty parent directories.
2789 dir="${compiled_file%/*}" 2791 dir="${compiled_file%/*}"
2790 while [[ "${dir}" != "${root}" ]]; do 2792 while [[ "${dir}" != "${root}" ]]; do
2791 if rmdir "${dir}" 2> /dev/null; then 2793 if ! rmdir "${dir}" 2> /dev/null; then
2792 echo "${_CYAN}<<< ${dir}${_NORMAL}"
2793 else
2794 break 2794 break
2795 fi 2795 fi
2796 dir="${dir%/*}" 2796 dir="${dir%/*}"
2797 done 2797 done
2798 done 2798 done

Legend:
Removed from v.1.153  
changed lines
  Added in v.1.156

  ViewVC Help
Powered by ViewVC 1.1.20