summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/ebuild-helpers/dohtml8
-rwxr-xr-xbin/ebuild-helpers/portageq8
-rwxr-xr-xbin/ebuild-ipc6
-rwxr-xr-xbin/ebuild.sh22
-rwxr-xr-xbin/misc-functions.sh8
-rw-r--r--pym/portage/__init__.py2
-rw-r--r--pym/portage/process.py5
-rw-r--r--pym/portage/tests/ebuild/test_ipc_daemon.py1
-rwxr-xr-xruntests.sh17
9 files changed, 44 insertions, 33 deletions
diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
index e1ab7d970..cb29dc3f3 100755
--- a/bin/ebuild-helpers/dohtml
+++ b/bin/ebuild-helpers/dohtml
@@ -1,15 +1,13 @@
#!/bin/bash
-# Copyright 2009 Gentoo Foundation
+# Copyright 2009-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
-# Set EPYTHON variable as empty so that dohtml.py doesn't try
-# to use potentially unsupported version of Python.
-EPYTHON= PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
- "$PORTAGE_BIN_PATH/dohtml.py" "$@"
+PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/dohtml.py" "$@"
ret=$?
[[ $ret -ne 0 ]] && helpers_die "$0 failed"
diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
index 3a06fdd68..ec30b66cb 100755
--- a/bin/ebuild-helpers/portageq
+++ b/bin/ebuild-helpers/portageq
@@ -1,10 +1,8 @@
#!/bin/bash
-# Copyright 2009 Gentoo Foundation
+# Copyright 2009-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
-# Set EPYTHON variable as empty so that portageq doesn't try
-# to use potentially unsupported version of Python.
-EPYTHON= PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
- exec "$PORTAGE_BIN_PATH/portageq" "$@"
+PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
+ exec "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/portageq" "$@"
diff --git a/bin/ebuild-ipc b/bin/ebuild-ipc
index b828a35cd..43e4a02ae 100755
--- a/bin/ebuild-ipc
+++ b/bin/ebuild-ipc
@@ -4,7 +4,5 @@
PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
-# Set EPYTHON variable as empty so that ebuild-ipc.py doesn't try
-# to use potentially unsupported version of Python.
-EPYTHON= PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
- exec "$PORTAGE_BIN_PATH/ebuild-ipc.py" "$@"
+PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \
+ exec "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/ebuild-ipc.py" "$@"
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 9af7e3867..e9f4b96cb 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"
@@ -164,10 +164,8 @@ has_version() {
return $?
fi
- # Set EPYTHON variable as empty so that portageq doesn't try
- # to use potentially unsupported version of Python.
- EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
- "${PORTAGE_BIN_PATH}"/portageq has_version "${ROOT}" "$1"
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" has_version "${ROOT}" "$1"
local retval=$?
case "${retval}" in
0)
@@ -187,10 +185,8 @@ portageq() {
die "portageq calls are not allowed in the global scope"
fi
- # Set EPYTHON variable as empty so that portageq doesn't try
- # to use potentially unsupported version of Python.
- EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
- "${PORTAGE_BIN_PATH}/portageq" "$@"
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" "$@"
}
@@ -211,10 +207,8 @@ best_version() {
return $?
fi
- # Set EPYTHON variable as empty so that portageq doesn't try
- # to use potentially unsupported version of Python.
- EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
- "${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1"
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1"
local retval=$?
case "${retval}" in
0)
@@ -1734,7 +1728,7 @@ filter_readonly_variables() {
"
fi
- EPYTHON= "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed"
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed"
}
# @FUNCTION: preprocess_ebuild_env
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index c965495b6..0108b001f 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# Miscellaneous shell functions that make use of the ebuild env but don't need
@@ -489,7 +489,7 @@ install_qa_check() {
done
[[ $reset_debug = 1 ]] && set -x
f=$(cat "${PORTAGE_LOG_FILE}" | \
- EPYTHON= "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed")
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed")
if [[ -n ${f} ]] ; then
# In the future this will be a forced "die". In preparation,
@@ -778,8 +778,8 @@ dyn_package() {
tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${D}" . | \
bzip2 -cf > "$PORTAGE_BINPKG_TMPFILE"
assert "failed to pack binary package: '$PORTAGE_BINPKG_TMPFILE'"
- EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
- "$PORTAGE_BIN_PATH"/xpak-helper.py recompose \
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH"/xpak-helper.py recompose \
"$PORTAGE_BINPKG_TMPFILE" "$PORTAGE_BUILDDIR/build-info"
if [ $? -ne 0 ]; then
rm -f "${PORTAGE_BINPKG_TMPFILE}"
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index a6760b245..fb4c66cb1 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -325,6 +325,8 @@ except (ImportError, OSError) as e:
# END OF IMPORTS -- END OF IMPORTS -- END OF IMPORTS -- END OF IMPORTS -- END
# ===========================================================================
+os.environ['PORTAGE_PYTHON'] = sys.executable
+
def _ensure_default_encoding():
default_encoding = sys.getdefaultencoding().lower().replace('-', '_')
diff --git a/pym/portage/process.py b/pym/portage/process.py
index 9f6ec0e56..331e88059 100644
--- a/pym/portage/process.py
+++ b/pym/portage/process.py
@@ -355,7 +355,7 @@ def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask,
# Then assign them to what they should be.
for fd in my_fds:
os.dup2(my_fds[fd], fd)
- # Then close _all_ fds that haven't been explictly
+ # Then close _all_ fds that haven't been explicitly
# requested to be kept open.
for fd in get_open_fds():
if fd not in my_fds:
@@ -375,6 +375,9 @@ def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask,
os.umask(umask)
if pre_exec:
pre_exec()
+
+ # Set requested Python interpreter for Portage helpers.
+ env['PORTAGE_PYTHON'] = sys.executable
# And switch to the new process.
os.execve(binary, myargs, env)
diff --git a/pym/portage/tests/ebuild/test_ipc_daemon.py b/pym/portage/tests/ebuild/test_ipc_daemon.py
index de548c6f1..b03409d0f 100644
--- a/pym/portage/tests/ebuild/test_ipc_daemon.py
+++ b/pym/portage/tests/ebuild/test_ipc_daemon.py
@@ -19,6 +19,7 @@ class IpcDaemonTestCase(TestCase):
tmpdir = tempfile.mkdtemp()
try:
env = {}
+ env['PORTAGE_PYTHON'] = os.environ['PORTAGE_PYTHON']
env['PORTAGE_BIN_PATH'] = PORTAGE_BIN_PATH
env['PORTAGE_PYM_PATH'] = PORTAGE_PYM_PATH
env['PORTAGE_BUILDDIR'] = tmpdir
diff --git a/runtests.sh b/runtests.sh
new file mode 100755
index 000000000..1afbfb3f4
--- /dev/null
+++ b/runtests.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+PYTHON_VERSIONS="2.6 2.7 3.1 3.2"
+
+exit_status="0"
+for version in ${PYTHON_VERSIONS}; do
+ if [[ -x /usr/bin/python${version} ]]; then
+ echo -e "\e[1;32mTesting with Python ${version}...\e[0m"
+ if ! PYTHONPATH="pym${PYTHONPATH:+:}${PYTHONPATH}" /usr/bin/python${version} pym/portage/tests/runTests; then
+ echo -e "\e[1;31mTesting with Python ${version} failed\e[0m"
+ exit_status="1"
+ fi
+ echo
+ fi
+done
+
+exit ${exit_status}