diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index b104b6694ac37..ddd1a25e6def0 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -601,12 +601,15 @@ python_optimize() { "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}" ;; - python*|pypy3) + python3.[5678]|pypy3) # both levels of optimization are separate since 3.5 "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" "${PYTHON}" -O -m compileall -q -f -d "${instpath}" "${d}" "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}" ;; + python*) + "${PYTHON}" -m compileall -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}" + ;; *) "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" ;;