Default to optimizing the `site-packages` directory rather than
the whole `sys.path` when no path is passed to `python_optimize`.
Technically, this is a breaking change, but it is unlikely that any
ebuilds have been actually relying on the old behavior, and in the worst
case our QA checks will note the missing .pyc files.
The old logic was assuming that a custom package may install overrides
to `sys.path` that we would need to account for. However, this assumes
that said overrides would actually start working *before* the package is installed (creating hard-to-reproduce bugs) -- and in these cases, we
really prefer listing special paths explicitly anyway.
Signed-off-by: Michał Górny <
mgorny@gentoo.org>
---
eclass/python-utils-r1.eclass | 23 ++---------------------
1 file changed, 2 insertions(+), 21 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 27a85410aadf..6d008bf63664 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -599,27 +599,8 @@ python_optimize() {
[[ ${PYTHON} ]] || _python_export PYTHON
[[ -x ${PYTHON} ]] || die "PYTHON (${PYTHON}) is not executable"
- # default to sys.path
- if [[ ${#} -eq 0 ]]; then
- local f
- while IFS= read -r -d '' f; do
- # 1) accept only absolute paths
- # (i.e. skip '', '.' or anything like that)
- # 2) skip paths which do not exist
- # (python2.6 complains about them verbosely)
-
- if [[ ${f} == /* && -d ${D}${f} ]]; then
- set -- "${D}${f}" "${@}"
- fi
- done < <(
- "${PYTHON}" - <<-EOF || die
- import sys
- print("".join(x + "\0" for x in sys.path))
- EOF
- )
-
- debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"