summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMart Raudsepp <leio@gentoo.org>2021-06-23 11:26:41 +0300
committerMichał Górny <mgorny@gentoo.org>2021-08-12 19:04:19 +0200
commit7a9b4f552e4c93525ab8d3a353bf8c4c1aee5537 (patch)
tree98fd620c20db988c144ec86a3481931fd04f9253 /eclass
parentsys-kernel/gentoo-kernel-bin: Bump to 5.4.140 (diff)
downloadgentoo-7a9b4f552e4c93525ab8d3a353bf8c4c1aee5537.tar.gz
gentoo-7a9b4f552e4c93525ab8d3a353bf8c4c1aee5537.tar.bz2
gentoo-7a9b4f552e4c93525ab8d3a353bf8c4c1aee5537.zip
python-utils-r1.eclass: Enable hardlinking of identical pyc files for py3.9+
Python 3.9 includes a new feature for compileall to automatically hardlink different optimization level cache files if they are identical. Make use of it for python_optimize for some space savings. This however does not cover distutils use cases and python itself. Signed-off-by: Mart Raudsepp <leio@gentoo.org> Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/python-utils-r1.eclass5
1 files changed, 4 insertions, 1 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index b104b6694ac3..ddd1a25e6def 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}"
;;