1 |
On Wed, 2021-06-23 at 12:36 +0300, Mart Raudsepp wrote: |
2 |
> Python 3.9 includes a new feature for compileall to automatically hardlink |
3 |
> different optimization level cache files if they are identical. Make use of it |
4 |
> for python_optimize for some space savings. |
5 |
> This however does not cover distutils use cases and python itself. |
6 |
> --- |
7 |
> eclass/python-utils-r1.eclass | 5 ++++- |
8 |
> 1 file changed, 4 insertions(+), 1 deletion(-) |
9 |
> |
10 |
> Note that I haven't actually tested this on py3.9, as I'm skipping that version. |
11 |
> It appears to do what it's meant to with py3.10 |
12 |
> |
13 |
> diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
14 |
> index 3dbf221eac5..e2f05606993 100644 |
15 |
> --- a/eclass/python-utils-r1.eclass |
16 |
> +++ b/eclass/python-utils-r1.eclass |
17 |
> @@ -626,12 +626,15 @@ python_optimize() { |
18 |
> "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" |
19 |
> "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}" |
20 |
> ;; |
21 |
> - python*|pypy3) |
22 |
> + python3.[5678]|pypy3) |
23 |
|
24 |
We don't really support < 3.8 anymore but I can update that while |
25 |
merging, I guess. |
26 |
|
27 |
> # both levels of optimization are separate since 3.5 |
28 |
> "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" |
29 |
> "${PYTHON}" -O -m compileall -q -f -d "${instpath}" "${d}" |
30 |
> "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}" |
31 |
> ;; |
32 |
> + python*) |
33 |
> + "${PYTHON}" -m compileall -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}" |
34 |
> + ;; |
35 |
> *) |
36 |
> "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" |
37 |
> ;; |
38 |
> |
39 |
> |
40 |
> |
41 |
|
42 |
-- |
43 |
Best regards, |
44 |
Michał Górny |