| 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.154 2012/03/29 12:47:35 marienz 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 |
| … | |
… | |
| 28 | fi |
28 | fi |
| 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 | # ================================================================================================ |
| … | |
… | |
| 1309 | pypy_versions_mapping = { |
1309 | pypy_versions_mapping = { |
| 1310 | "1.5": "2.7", |
1310 | "1.5": "2.7", |
| 1311 | "1.6": "2.7", |
1311 | "1.6": "2.7", |
| 1312 | "1.7": "2.7", |
1312 | "1.7": "2.7", |
| 1313 | "1.8": "2.7", |
1313 | "1.8": "2.7", |
|
|
1314 | "1.9": "2.7", |
| 1314 | } |
1315 | } |
| 1315 | |
1316 | |
| 1316 | def get_PYTHON_ABI(python_interpreter): |
1317 | def get_PYTHON_ABI(python_interpreter): |
| 1317 | cpython_matched = cpython_interpreter_re.match(python_interpreter) |
1318 | cpython_matched = cpython_interpreter_re.match(python_interpreter) |
| 1318 | jython_matched = jython_interpreter_re.match(python_interpreter) |
1319 | jython_matched = jython_interpreter_re.match(python_interpreter) |
| … | |
… | |
| 2765 | if [[ "${EBUILD_PHASE}" == "postinst" ]]; then |
2766 | if [[ "${EBUILD_PHASE}" == "postinst" ]]; then |
| 2766 | [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue |
2767 | [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue |
| 2767 | else |
2768 | else |
| 2768 | [[ -f "${py_file}" ]] && continue |
2769 | [[ -f "${py_file}" ]] && continue |
| 2769 | fi |
2770 | fi |
| 2770 | echo "${_BLUE}<<< ${compiled_file%[co]}[co]${_NORMAL}" |
|
|
| 2771 | rm -f "${compiled_file%[co]}"[co] |
2771 | rm -f "${compiled_file%[co]}"[co] |
| 2772 | elif [[ "${compiled_file}" == *\$py.class ]]; then |
2772 | elif [[ "${compiled_file}" == *\$py.class ]]; then |
| 2773 | if [[ "${dir}" == "__pycache__" ]]; then |
2773 | if [[ "${dir}" == "__pycache__" ]]; then |
| 2774 | base_module_name="${compiled_file##*/}" |
2774 | base_module_name="${compiled_file##*/}" |
| 2775 | base_module_name="${base_module_name%\$py.class}" |
2775 | base_module_name="${base_module_name%\$py.class}" |
| … | |
… | |
| 2780 | if [[ "${EBUILD_PHASE}" == "postinst" ]]; then |
2780 | if [[ "${EBUILD_PHASE}" == "postinst" ]]; then |
| 2781 | [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue |
2781 | [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue |
| 2782 | else |
2782 | else |
| 2783 | [[ -f "${py_file}" ]] && continue |
2783 | [[ -f "${py_file}" ]] && continue |
| 2784 | fi |
2784 | fi |
| 2785 | echo "${_BLUE}<<< ${compiled_file}${_NORMAL}" |
|
|
| 2786 | rm -f "${compiled_file}" |
2785 | rm -f "${compiled_file}" |
| 2787 | else |
2786 | else |
| 2788 | die "${FUNCNAME}(): Unrecognized file type: '${compiled_file}'" |
2787 | die "${FUNCNAME}(): Unrecognized file type: '${compiled_file}'" |
| 2789 | fi |
2788 | fi |
| 2790 | |
2789 | |
| 2791 | # Delete empty parent directories. |
2790 | # Delete empty parent directories. |
| 2792 | dir="${compiled_file%/*}" |
2791 | dir="${compiled_file%/*}" |
| 2793 | while [[ "${dir}" != "${root}" ]]; do |
2792 | while [[ "${dir}" != "${root}" ]]; do |
| 2794 | if rmdir "${dir}" 2> /dev/null; then |
2793 | if ! rmdir "${dir}" 2> /dev/null; then |
| 2795 | echo "${_CYAN}<<< ${dir}${_NORMAL}" |
|
|
| 2796 | else |
|
|
| 2797 | break |
2794 | break |
| 2798 | fi |
2795 | fi |
| 2799 | dir="${dir%/*}" |
2796 | dir="${dir%/*}" |
| 2800 | done |
2797 | done |
| 2801 | done |
2798 | done |