blob: b314bce9f5803985704f0ab85b0cbdd4400d2517 [file] [log] [blame]
#!/bin/bash
# Copyright 2009-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
scriptpath=${BASH_SOURCE[0]}
scriptname=${scriptpath##*/}
# Use safe cwd, avoiding unsafe import for bug #469338.
cd "${PORTAGE_PYM_PATH}" || exit 1
IFS=':'
set -f # in case ${PATH} contains any shell glob characters
for path in ${PATH}; do
[[ -x ${path}/${scriptname} ]] || continue
[[ ${path} == ${PORTAGE_OVERRIDE_EPREFIX}/usr/lib*/portage/* ]] && continue
[[ ${path} == */._portage_reinstall_.* ]] && 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