@@ -, +, @@ --- bin/ebuild-helpers/portageq | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) --- a/bin/ebuild-helpers/portageq +++ a/bin/ebuild-helpers/portageq @@ -2,9 +2,24 @@ # Copyright 2009-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +scriptpath=${BASH_SOURCE[0]} +scriptname=${scriptpath##*/} + PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} # Use safe cwd, avoiding unsafe import for bug #469338. cd "${PORTAGE_PYM_PATH}" -PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \ - exec "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/portageq" "$@" + +IFS=':' + +for path in ${PATH}; do + [[ -x ${path}/${scriptname} ]] || continue + [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue + PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \ + exec "${PORTAGE_PYTHON:-/usr/bin/python}" \ + "${path}/${scriptname}" "$@" +done + +unset IFS +echo "${scriptname}: command not found" 1>&2 +exit 127 --