On 13 Dec 2001 15:34:17 -0600
cmpilato@collab.net wrote:
...
> > +OK=`python -c 'print "OK"'`
> > +if test "${OK}" != "OK" ; then
> > +  echo "Python check failed, make sure python is installed and on the PATH"
> > +  exit 1
> > +fi
> > +
> 
> Right here, I think the error output should say that we require
> *Python 2 or greater* to be in the PATH.
My mistake. I should have added a comment there stating that only Python 1.X
is required to run gen-make.py (added to revised patch below).
> > -dnl Find a python binary, refer
> > +dnl Find a python 2.X binary, test cases will not run with in Python 1.X
> 
> That should be "...run within Python..." :-)
Doh!
> Finally, do we want to repeat this test/warning at 'make check' time?
> You know, somebody gets the source, ignores the warning at autogen.sh
> time because she doesn't plan to contribute.  Then ends up
> contributing later and freaks when she runs 'make check' -- in fact,
> we could at 'make check' time just skip all the python tests if the
> right version of Python isn't detected:
We already do that, and it does not help. The log currently reads:
START: basic_tests.py
<<< Please make sure you have Python 2 or better! >>>
...
Assuming that users will read things is a common error.
They need to be beaten over the head with this error message
since lots of folks will not have python 2 installed.
Greg Stein wrote:
> Instead of this, let's just write a Python script that checks its own
> version and exits with 0 or 1. I think this should do the trick:
That is much better that what I had, adding it to revised patch.
cheers
Mo
2001-12-13  Mo DeJong  <supermo@bayarea.net>
        * Makefile.in: Check python version before running
        test cases.
        * autogen.sh: Check to see if python is installed
        before generating build files.
        * configure.in: Check installed python version.
        * pycheck.py: New script that will check the
        installed version of python and print a warning
        unless python 2.X or newer is found.
Index: Makefile.in
===================================================================
--- .svn/text-base/Makefile.in.svn-base	Wed Dec  5 06:57:05 2001
+++ Makefile.in	Thu Dec 13 06:49:40 2001
@@ -117,6 +117,7 @@
         @logfile=`pwd`/tests.log ; \
         echo > $$logfile ; \
         failed=no ; \
+	$(PYTHON) $(top_srcdir)/pycheck.sh ; \
         list='$(TEST_PROGRAMS) @FS_TEST_PROGRAMS@'; for prog in $$list; do \
             chmod a+x $$prog ; \
             progbase=`echo $$prog | sed 's?.*/??'` ; \
Index: autogen.sh
===================================================================
--- .svn/text-base/autogen.sh.svn-base	Wed Dec  5 06:57:05 2001
+++ autogen.sh	Thu Dec 13 06:47:16 2001
@@ -72,7 +72,15 @@
 # Create the file detailing all of the build outputs for SVN.
 #
 # Note: this dependency on Python is fine: only SVN developers use autogen.sh
-#       and we can state that dev people need Python on their machine
+#       and we can state that dev people need Python on their machine. Note
+#	that running gen-make.py requires Python 1.X or newer.
+
+OK=`python -c 'print "OK"'`
+if test "${OK}" != "OK" ; then
+  echo "Python check failed, make sure python is installed and on the PATH"
+  exit 1
+fi
+
 if test "$1" = "-s"; then
   echo "Creating build-outputs.mk (no dependencies)..."
   ./gen-make.py -s build.conf ;
@@ -82,7 +90,7 @@
 fi
 
 if test "$?" != "0"; then
-  echo "gen-make.py failed, is python really installed?"
+  echo "gen-make.py failed"
   exit 1
 fi
 
Index: configure.in
===================================================================
--- .svn/text-base/configure.in.svn-base	Wed Dec  5 06:57:03 2001
+++ configure.in	Thu Dec 13 06:49:41 2001
@@ -258,13 +258,17 @@
 AC_DEFINE_UNQUOTED(SVN_PATH_STRIP_TRAILING_SLASHDOT, 0,
         [Non-zero if the trailing /. in paths should be stripped])
 
-dnl Find a python binary, refer
+dnl Find a python 2.X binary, test cases will not run with Python 1.X
 
 AC_PATH_PROG(PYTHON2, python2, none)
 if test "$PYTHON2" = "none"; then
-	AC_PATH_PROG(PYTHON, python, fail-without-python)
+	AC_PATH_PROG(PYTHON, python, none)
 else
         PYTHON=$PYTHON2
+fi
+if test "$PYTHON" != "none"; then
+  echo "checking for Python 2.0 or newer"
+  ${SHELL} ${abs_srcdir}/pycheck.sh ${PYTHON}
 fi
 
 AC_PATH_PROG(MAKEINFO, makeinfo, [echo cannot run makeinfo])
Index: pycheck.py
===================================================================
--- /dev/null   Tue May  5 13:32:27 1998
+++ pycheck.py  Thu Dec 13 06:46:49 2001
@@ -0,0 +1,5 @@
+import sys
+if sys.hexversion < 0x2000000:
+  print "pycheck: WARNING, Python 2.X or newer is required to run tests."
+  sys.exit(1)
+sys.exit(0)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:53 2006