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>
---
eclass/python-utils-r1.eclass | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index b61bf730b8c4..1a7d76e758a5 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
"${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
}
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)