diff options
| author | Michał Górny <mgorny@gentoo.org> | 2025-05-06 11:18:06 +0200 |
|---|---|---|
| committer | Michał Górny <mgorny@gentoo.org> | 2025-05-08 14:32:48 +0200 |
| commit | aff1a7696b6fe7b83374ea20c2e08772b7186cc2 (patch) | |
| tree | f4df018ebae5510196d2d98e93a73186f460f75c /eclass/python-utils-r1.eclass | |
| parent | 327899889ff0d4841870c0a81fa5adaa4b3fada0 (diff) | |
| download | gentoo-aff1a7696b6fe7b83374ea20c2e08772b7186cc2.tar.gz gentoo-aff1a7696b6fe7b83374ea20c2e08772b7186cc2.tar.bz2 gentoo-aff1a7696b6fe7b83374ea20c2e08772b7186cc2.zip | |
python-utils-r1.eclass: Switch python_optimize to use -s
Switch `python_optimize()` to use a combination of `-s` and `-p` options
instead of `-d`, since the latter does not seem to work correctly
in some cases, e.g. with `www-servers/uwsgi`:
```
The stripdir path '/tmp/portage/www-servers/uwsgi-2.0.27/image/usr/lib/python3.13/site-packages/' is not a valid prefix for source path '/tmp/portage/www-servers/uwsgi-2.0.27/image/usr/lib/python3.13/site-packages/uwsgidecorators.py'; ignoring
```
These options are supported in all Python versions the eclasses
currently do support.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/python-utils-r1.eclass')
| -rw-r--r-- | eclass/python-utils-r1.eclass | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index b61bf730b8c4..4fedd2b8a790 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -624,13 +624,11 @@ python_optimize() { local jobs=$(makeopts_jobs) local d for d; do - # make sure to get a nice path without // - local instpath=${d#${D}} - instpath=/${instpath##/} - einfo "Optimize Python modules for ${instpath}" + # NB: '-s' makes the path relative, so we need '-p /' to make it + # absolute again; https://github.com/python/cpython/issues/133503 "${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 \ - --hardlink-dupes -q -f -d "${instpath}" "${d}" + --hardlink-dupes -q -f -s "${D}" -p / "${d}" done } |
