blob: d31bd681079bd74e9fd0846fe3fc9a63d47e512b [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/*/ebuild-helpers* ]] && 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