| 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.155 2012/06/09 10:01:19 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 |
| … | |
… | |
| 2766 | if [[ "${EBUILD_PHASE}" == "postinst" ]]; then |
2766 | if [[ "${EBUILD_PHASE}" == "postinst" ]]; then |
| 2767 | [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue |
2767 | [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue |
| 2768 | else |
2768 | else |
| 2769 | [[ -f "${py_file}" ]] && continue |
2769 | [[ -f "${py_file}" ]] && continue |
| 2770 | fi |
2770 | fi |
| 2771 | echo "${_BLUE}<<< ${compiled_file%[co]}[co]${_NORMAL}" |
|
|
| 2772 | rm -f "${compiled_file%[co]}"[co] |
2771 | rm -f "${compiled_file%[co]}"[co] |
| 2773 | elif [[ "${compiled_file}" == *\$py.class ]]; then |
2772 | elif [[ "${compiled_file}" == *\$py.class ]]; then |
| 2774 | if [[ "${dir}" == "__pycache__" ]]; then |
2773 | if [[ "${dir}" == "__pycache__" ]]; then |
| 2775 | base_module_name="${compiled_file##*/}" |
2774 | base_module_name="${compiled_file##*/}" |
| 2776 | base_module_name="${base_module_name%\$py.class}" |
2775 | base_module_name="${base_module_name%\$py.class}" |
| … | |
… | |
| 2781 | if [[ "${EBUILD_PHASE}" == "postinst" ]]; then |
2780 | if [[ "${EBUILD_PHASE}" == "postinst" ]]; then |
| 2782 | [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue |
2781 | [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue |
| 2783 | else |
2782 | else |
| 2784 | [[ -f "${py_file}" ]] && continue |
2783 | [[ -f "${py_file}" ]] && continue |
| 2785 | fi |
2784 | fi |
| 2786 | echo "${_BLUE}<<< ${compiled_file}${_NORMAL}" |
|
|
| 2787 | rm -f "${compiled_file}" |
2785 | rm -f "${compiled_file}" |
| 2788 | else |
2786 | else |
| 2789 | die "${FUNCNAME}(): Unrecognized file type: '${compiled_file}'" |
2787 | die "${FUNCNAME}(): Unrecognized file type: '${compiled_file}'" |
| 2790 | fi |
2788 | fi |
| 2791 | |
2789 | |
| 2792 | # Delete empty parent directories. |
2790 | # Delete empty parent directories. |
| 2793 | dir="${compiled_file%/*}" |
2791 | dir="${compiled_file%/*}" |
| 2794 | while [[ "${dir}" != "${root}" ]]; do |
2792 | while [[ "${dir}" != "${root}" ]]; do |
| 2795 | if rmdir "${dir}" 2> /dev/null; then |
2793 | if ! rmdir "${dir}" 2> /dev/null; then |
| 2796 | echo "${_CYAN}<<< ${dir}${_NORMAL}" |
|
|
| 2797 | else |
|
|
| 2798 | break |
2794 | break |
| 2799 | fi |
2795 | fi |
| 2800 | dir="${dir%/*}" |
2796 | dir="${dir%/*}" |
| 2801 | done |
2797 | done |
| 2802 | done |
2798 | done |