When called from ebuilds without anything to clean up (e.g. unmerging gimp that has been installed without python support), the function works on non-existing paths. One could argue it's up to the ebuild author, but on unmerging we can't rely on the current use flags set, so checking the path is necessary anyways, so why not do it in python_mod_cleanup() itself. Any reason I should not commit the following!? --- python.eclass 2007-05-08 19:45:36.000000000 +0200 +++ python.eclass.new 2007-08-19 17:44:54.000000000 +0200 @@ -216,17 +216,19 @@ fi for path in ${SEARCH_PATH}; do - einfo "Cleaning orphaned Python bytecode from ${path} .." - for obj in $(find ${path} -name *.py[co]); do - src_py="${obj%[co]}" - if [ ! -f "${src_py}" ]; then - einfo "Purging ${src_py}[co]" - rm -f ${src_py}[co] - fi - done - # attempt to remove directories that maybe empty - for dir in $(find ${path} -type d | sort -r); do - rmdir ${dir} 2>/dev/null - done + if [[ -d "${path}" ]] ; then + einfo "Cleaning orphaned Python bytecode from ${path} .." + for obj in $(find ${path} -name *.py[co]); do + src_py="${obj%[co]}" + if [ ! -f "${src_py}" ]; then + einfo "Purging ${src_py}[co]" + rm -f ${src_py}[co] + fi + done + # attempt to remove directories that maybe empty + for dir in $(find ${path} -type d | sort -r); do + rmdir ${dir} 2>/dev/null + done + fi done }
(In reply to comment #0) > but on unmerging we can't > rely on the current use flags set, so checking the path is necessary anyways, I fails to see what does this have in common with use flags; on unmerge, USE flags from VDB are used, not the current ones.
Alternative patch was committed some time ago to fix another problem.