aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2021-03-04 00:34:43 -0800
committerZac Medico <zmedico@gentoo.org>2021-03-04 00:59:04 -0800
commitcec73041df583bfd46e1fa9739286a74a2e85b18 (patch)
tree86e538bcacbb003a29d9454a37adb49e7c7b76d3 /bin/ebuild-pyhelper
parentsetup.py: fix EPREFIX and PORTAGE_BASE_PATH for pip install (diff)
downloadportage-cec73041df583bfd46e1fa9739286a74a2e85b18.tar.gz
portage-cec73041df583bfd46e1fa9739286a74a2e85b18.tar.bz2
portage-cec73041df583bfd46e1fa9739286a74a2e85b18.zip
bin/ebuild-pyhelper: wrapper for portage python helpers
Merge the shell script wrappers for chmod-lite and ebuild-ipc into a single ebuild-pyhelper script. Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'bin/ebuild-pyhelper')
-rwxr-xr-xbin/ebuild-pyhelper21
1 files changed, 21 insertions, 0 deletions
diff --git a/bin/ebuild-pyhelper b/bin/ebuild-pyhelper
new file mode 100755
index 000000000..d32bc6f6f
--- /dev/null
+++ b/bin/ebuild-pyhelper
@@ -0,0 +1,21 @@
+#!/bin/bash
+# Copyright 2010-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+export __PORTAGE_HELPER_CWD=${PWD}
+
+if [[ ${0##*/} == "ebuild-pyhelper" ]]; then
+ echo "ebuild-pyhelper: must be called via symlink" &>2
+ exit 1
+fi
+
+# Use safe cwd, avoiding unsafe import for bug #469338.
+cd "${PORTAGE_PYM_PATH}" || exit 1
+for path in "${PORTAGE_BIN_PATH}/${0##*/}"{.py,}; do
+ if [[ -x "${path}" ]]; then
+ PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
+ exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${path}" "$@"
+ fi
+done
+echo "File not found: ${path}" >&2
+exit 1