[pacman-dev] [PATCH v2 1/8] Bail early with a clear error message if Python runtime isn't 2.7+.

Jeremy Heiner scalaprotractor at gmail.com
Sat Oct 12 12:44:30 EDT 2013


Prior to this a test that used a feature too new for the runtime would
blow up when it was "exec"d (possibly in the middle of a run of a
bunch of tests) with an error message that was not very helpful.

Remove Python 2.5 and 2.6 runtimes from the list configure searches.
2.5 suffers the problem described above. The code currently will run
on 2.6 but, as was noted on the dev list, that runtime is at the end
of its life, so 2.7 is a better cutoff.

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
---
 configure.ac           | 2 +-
 test/pacman/pactest.py | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 42416a4..cfcc8d1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -169,7 +169,7 @@ AC_SYS_LARGEFILE
 AC_PROG_AWK
 AC_PROG_CC_C99
 AC_PROG_INSTALL
-AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 python], [false])
+AC_CHECK_PROGS([PYTHON], [python2.7 python2 python], [false])
 AC_PATH_PROGS([BASH_SHELL], [bash bash4], [false])
 
 # check for perl 5.10.1 (needed by makepkg-template)
diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py
index d39fcaa..e21cde7 100755
--- a/test/pacman/pactest.py
+++ b/test/pacman/pactest.py
@@ -77,6 +77,12 @@ def create_parser():
 
 
 if __name__ == "__main__":
+
+    if sys.hexversion < 0x02070000:
+        # bailing now with clear message better than mid-run with unhelpful one
+        tap.bail("Python versions before 2.7 are not supported.")
+        sys.exit(1)
+
     # instantiate env and parser objects
     root_path = tempfile.mkdtemp()
     env = pmenv.pmenv(root=root_path)
-- 
1.8.4



More information about the pacman-dev mailing list