[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Require Python 2.0 or later in autogen.sh and configure

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2005-08-24 00:25:30 CEST

David James <james82@gmail.com> writes:

> [[[
> Require Python 2.0 or later for autogen.sh and configure. Look in the
> following locations (in order) for Python 2.0 or better: $PYTHON2,
> $PYTHON, python, python2
>
> * autogen.sh:
> Use ./build/find_python.sh to find Python 2.0.
> * configure.in:
> (PYTHON): Use $srcdir/build/find_python.sh to find Python 2.0.
> * build/find_python.sh:
> New file. Look in the following locations (in order) for Python 2.0
> or better: $PYTHON2, $PYTHON, python, python2

You have written out the new order twice, something that is available
by examining the code and so doesn't really need to be in the log
message at all, but you haven't mentioned the change in the order.
I'd use something more like:

[[[
Require Python 2.0 or later for autogen.sh and configure. Look for
a suitable "python" command before "python2".

* autogen.sh: Introduce PYTHON, use find_python.sh.

* configure.in (PYTHON): Use find_python.sh.

* build/find_python.sh: New.
]]]

> Here's some examples to illustrate how the new code behaves:
>
> Scenario 1:
> * "python" refers to Python 1.x
> * "python2" refers to Python 2.2
> -> We use "python2", because "python" is too old.
>
> Scenario 2:
> * "python" refers to Python 2.2
> * "python2" refers to Python 2.2
> -> We use "python", because the user may have installed a local
> version of python using the standard name "python", which they
> want us to use instead of the system-wide "python2".

That's a bit of dubious argument as far as I can see. My system
doesn't come with a "python2" command ("python" is a Python 2). I
could install a local "python2" to override the system's "python".

"python2" used to have precedence over "python" and I think that makes
sense, but I don't really care.

> Index: configure.in
> ===================================================================
> --- configure.in (revision 15884)
> +++ configure.in (working copy)
> @@ -537,28 +537,17 @@
>
> # Python: Used for testsuite, and bindings
>
> -# For compatibility with Subversion 1.1.3 and earlier,
> -# which recommended setting PYTHON2, not PYTHON.

You have deleted the reasoning for PYTHON2 to come before PYTHON.

> -if test "${PYTHON2+set}" = set -a "${PYTHON+set}" != set; then
> - PYTHON="$PYTHON2"
> -fi
>
> -AC_PATH_PROGS(PYTHON, python2 python, none)
> -if test "$PYTHON" != "none"; then
> - AC_MSG_CHECKING([that the Python found is at least version 2.0])
> - if "$PYTHON" -c 'import sys;sys.exit((sys.hexversion < 0x2000000) and 1 or 0)'; then
> - AC_MSG_RESULT([yes])
> - else
> - PYTHON="none"
> - AC_MSG_RESULT([no])
> - AC_MSG_WARN([The detected Python is too old for Subversion to use])
> - AC_MSG_WARN([At least Python 2.0 is required to run the testsuite])
> - AC_MSG_WARN([or to use the Subversion Python bindings])
> - AC_MSG_WARN([])
> - AC_MSG_WARN([If you have a suitable Python installed, but not on the])
> - AC_MSG_WARN([PATH, set the environment variable PYTHON to the full path])
> - AC_MSG_WARN([to the Python executable, and re-run configure])
> - fi
> +PYTHON=`$abs_srcdir/build/find_python.sh`
> +if test -z "$PYTHON"; then
> + AC_MSG_WARN([Python 2.0 or later is required to run the testsuite])
> + AC_MSG_WARN([or to use the Subversion Python bindings])
> + AC_MSG_WARN([])
> + AC_MSG_WARN([If you have a suitable Python installed, but not on the])
> + AC_MSG_WARN([PATH, set the environment variable PYTHON to the full path])
> + AC_MSG_WARN([to the Python executable, and re-run configure])
> +else
> + AC_PATH_PROGS(PYTHON, "$PYTHON", none)
> fi
>
> # SVN_CHECK_JDK sets $JAVA_CLASSPATH
> Index: build/find_python.sh
> ===================================================================
> --- build/find_python.sh (revision 0)
> +++ build/find_python.sh (revision 0)
> @@ -0,0 +1,15 @@
> +#!/bin/sh
> +
> +# Required version of Python
> +# Python 2.0 = 0x2000000
> +# Python 2.2 = 0x2020000
> +VERSION=${1:-0x2000000}
> +
> +for x in "$PYTHON2" "$PYTHON" python python2; do

PYTHON2 before PYTHON, but python before python2; doesn't that look
odd to you? It needs a comment.

> + DETECT_PYTHON2="import sys;sys.exit((sys.hexversion < $VERSION) and 1 or 0)"
> + if "$x" -c "$DETECT_PYTHON2" >/dev/null 2>/dev/null; then
> + echo $x
> + exit 0
> + fi
> +done
> +exit 1

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Aug 24 00:26:21 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.