Remove need for Python 2to3

All Python examples and tests have been written to be both Python 2 and Python 3
compatible, removing the need for 2to3 to run the examples or test-suite.

The 2to3 executable is not always available and even when available does not
always work, e.g. with pyenv. An alternative would be to use the lib2to3 Python
module instead, but this isn't available in some older versions of Python 3.

I had this problem on Ubuntu Bionic on Travis:

  checking Examples/python/callback
  pyenv: 2to3-3.8: command not found
  The `2to3-3.8' command exists in these Python versions:
    3.8
    3.8.1

Reference issues:
  https://github.com/pypa/virtualenv/issues/1399
  https://travis-ci.community/t/2to3-command-not-found-in-venv-in-bionic/4495
This commit is contained in:
William S Fulton 2020-08-15 18:04:58 +01:00
commit ec2b47ef2a
5 changed files with 11 additions and 118 deletions

View file

@ -919,30 +919,6 @@ if test -n "$PYINCLUDE" || test -n "$PY3INCLUDE" ; then
fi
fi
AC_ARG_WITH(2to3, AS_HELP_STRING([--with-2to3=path], [Set location of Python 2to3 tool]), [PY2TO3BIN="$withval"], [PY2TO3BIN="yes"])
if test -n "$PYTHON3"; then
if test "x$PY2TO3BIN" = xyes; then
py3to2=`echo $PYTHON3 | sed -e "s/python/2to3-/"`
AC_CHECK_PROGS(PY2TO3, $py3to2 2to3)
if test -z "$PY2TO3"; then
# Windows distributions don't always have the 2to3 executable
AC_MSG_CHECKING(for 2to3.py)
py2to3script="$PY3PREFIX/Tools/scripts/2to3.py"
if test -f "$py2to3script"; then
AC_MSG_RESULT($py2to3script)
PY2TO3="$PYTHON3 $py2to3script"
else
AC_MSG_RESULT(Not found)
fi
fi
else
PY2TO3="$PY2TO3BIN"
fi
if test -z "$PY2TO3"; then
PYTHON3=
fi
fi
#----------------------------------------------------------------
# Look for Perl5
#----------------------------------------------------------------