--- python.eclass +++ python.eclass @@ -2278,7 +2278,7 @@ _python_initialize_prefix_variables _python_set_color_variables - [[ "${FUNCNAME[1]}" =~ ^(python_mod_optimize|python_mod_compile|python_mod_cleanup)$ ]] || die "${FUNCNAME}(): Invalid usage" + [[ "${FUNCNAME[1]}" =~ ^(python_mod_optimize|python_mod_cleanup)$ ]] || die "${FUNCNAME}(): Invalid usage" local base_module_name compiled_file compiled_files=() dir path py_file root @@ -2606,8 +2606,7 @@ elif [[ -d "${myroot}/${1#/}" ]]; then mydirs+=("${myroot}/${1#/}") elif [[ -f "${myroot}/${1#/}" ]]; then - # Files are passed to python_mod_compile which is EROOT-aware - myfiles+=("$1") + myfiles+=("${myroot}/${1#/}") elif [[ -e "${myroot}/${1#/}" ]]; then eerror "${FUNCNAME}(): ${myroot}/${1#/} is not a regular file or directory" else @@ -2629,7 +2628,9 @@ fi if ((${#myfiles[@]})); then - python_mod_compile "${myfiles[@]}" + "$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" || return_code="1" + "$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" &> /dev/null || return_code="1" + _python_clean_compiled_modules "${myfiles[@]}" fi eend "${return_code}" @@ -2783,52 +2784,8 @@ die "${FUNCNAME}() is banned" } -# @FUNCTION: python_mod_compile -# @USAGE: [more files ...] -# @DESCRIPTION: -# Given filenames, it will pre-compile the module's .pyc and .pyo. -# This function can be used only in pkg_postinst() phase. -# -# Example: -# python_mod_compile /usr/lib/python2.3/site-packages/pygoogle.py -# +# Scheduled for deletion on 2011-04-01. python_mod_compile() { - if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then - eerror "Use python_mod_optimize() instead of ${FUNCNAME}()." - die "${FUNCNAME}() cannot be used in this EAPI" - fi - - _python_initialize_prefix_variables - _python_set_color_variables - - if [[ "${FUNCNAME[1]}" != "python_mod_optimize" ]]; then - ewarn - ewarn "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-09-01." - ewarn "Use python_mod_optimize() instead of ${FUNCNAME}()." - ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported." - ewarn - fi - - local f myroot myfiles=() - - # Check if phase is pkg_postinst() - [[ "${EBUILD_PHASE}" != "postinst" ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase" - - # strip trailing slash - myroot="${EROOT%/}" - - # respect EROOT - for f in "$@"; do - [[ -f "${myroot}/${f}" ]] && myfiles+=("${myroot}/${f}") - done - - PYTHON_ABI="$(PYTHON --ABI)" - - if ((${#myfiles[@]})); then - "$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" - "$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" &> /dev/null - _python_clean_compiled_modules "${myfiles[@]}" - else - ewarn "No files to compile!" - fi + eerror "Use python_mod_optimize() instead of ${FUNCNAME}()." + die "${FUNCNAME}() is banned" }