Improve support for PyPy in python_mod_optimize(). (Patch by Arfrever. Backported from Progress Overlay.) --- python.eclass +++ python.eclass @@ -2980,7 +2980,7 @@ eval "dirs+=(\"\${root}${dir}\")" done stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m compileall "${options[@]}" "${dirs[@]}" 2>&1)" || return_code="1" - if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then + if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then "$(PYTHON)" -O -m compileall "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1" fi _python_clean_compiled_modules "${dirs[@]}" @@ -2993,7 +2993,7 @@ eval "files+=(\"\${root}${file}\")" done stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m py_compile "${files[@]}" 2>&1)" || return_code="1" - if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then + if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then "$(PYTHON)" -O -m py_compile "${files[@]}" &> /dev/null || return_code="1" fi _python_clean_compiled_modules "${files[@]}" @@ -3024,14 +3024,14 @@ ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation_and_version)" if ((${#other_dirs[@]})); then stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m compileall "${options[@]}" "${other_dirs[@]}" 2>&1)" || return_code="1" - if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then + if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then "$(PYTHON ${PYTHON_ABI})" -O -m compileall "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1" fi _python_clean_compiled_modules "${other_dirs[@]}" fi if ((${#other_files[@]})); then stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m py_compile "${other_files[@]}" 2>&1)" || return_code="1" - if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then + if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then "$(PYTHON ${PYTHON_ABI})" -O -m py_compile "${other_files[@]}" &> /dev/null || return_code="1" fi _python_clean_compiled_modules "${other_files[@]}"