Index: python.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v retrieving revision 1.41 diff -u -r1.41 python.eclass --- python.eclass 30 May 2008 09:58:28 -0000 1.41 +++ python.eclass 30 May 2008 10:02:01 -0000 @@ -10,7 +10,7 @@ # @BLURB: A Utility Eclass that should be inherited by anything that deals with Python or Python modules. # @DESCRIPTION: # Some useful functions for dealing with python. -inherit alternatives multilib +inherit alternatives multilib versionator if [[ -n "${NEED_PYTHON}" ]] ; then @@ -73,11 +73,29 @@ } python_version() { - local tmpstr + local tmpstr myver python=${python:-/usr/bin/python} tmpstr="$(${python} -V 2>&1 )" export PYVER_ALL="${tmpstr#Python }" __python_version_extract $PYVER_ALL + + # Check if the active python versions on HOST and TARGET are same. + myver=$(best_version dev-lang/python) + myver=${myver/dev-lang\/python-/} + myver=$(get_version_component_range 1-2 ${myver}) + + if [[ ${PYVER} != ${myver} ]]; then + ewarn "Active python versions on HOST and TARGET aren't same!" + if [[ -x /usr/bin/python${myver} ]]; then + ewarn "It seems you have /usr/bin/python${myver} installed." + ewarn "We'll be using it instead of your active python." + export PYVER_ALL=${myver} + __python_version_extract ${PYVER_ALL} + else + ewarn "This is asking for trouble." + ebeep + fi + fi } # @FUNCTION: python_makesym