From 831b9d1880e5300b33c9e70d2faee2a457699dc0 Mon Sep 17 00:00:00 2001
From: Tim Ruehsen <tim.ruehsen@gmx.de>
Date: Wed, 5 Nov 2014 21:35:13 +0100
Subject: [PATCH] Skip python tests if python3 is not available

Reported-by: kdevel@vogtner.de
---
 ChangeLog           | 5 +++++
 configure.ac        | 6 ++++++
 testenv/Makefile.am | 6 ++++--
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a7357aaa..e9595f7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-05  Tim Ruehsen <tim.ruehsen@gmx.de>
+
+	* configure.ac: check for python3
+	* Makefile.am: only use python test suite if python3 found
+
 2014-11-05  Giuseppe Scrivano  <gscrivan@redhat.com>
 
 	* contrib/tsocked-wget (TSOCKS_CONF_FILE): Remove empty new-line.
diff --git a/configure.ac b/configure.ac
index 01d3eef5..70284812 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,6 +135,12 @@ AC_AIX
 
 gl_EARLY
 
+dnl
+dnl Find python3
+dnl
+AM_PATH_PYTHON([3.0],,[:])
+AM_CONDITIONAL([HAVE_PYTHON3], [test "$PYTHON" != :])
+
 dnl
 dnl Gettext
 dnl
diff --git a/testenv/Makefile.am b/testenv/Makefile.am
index 33604bcb..f745bdb2 100644
--- a/testenv/Makefile.am
+++ b/testenv/Makefile.am
@@ -29,7 +29,8 @@
 AUTOMAKE_OPTIONS = parallel-tests
 AM_TESTS_ENVIRONMENT = export WGETRC=/dev/null; MAKE_CHECK=True; export MAKE_CHECK;\
  export PYTHONPATH=$$PYTHONPATH:$(srcdir); export VALGRIND_TESTS="@VALGRIND_TESTS@";
-TESTS = Test-auth-basic-fail.py             \
+if HAVE_PYTHON3
+  TESTS = Test-auth-basic-fail.py           \
     Test-auth-basic.py                      \
     Test-auth-both.py                       \
     Test-auth-digest.py                     \
@@ -50,7 +51,8 @@ TESTS = Test-auth-basic-fail.py             \
     Test-Post.py                            \
     Test--spider-r.py
 
-XFAIL_TESTS = Test-auth-both.py
+  XFAIL_TESTS = Test-auth-both.py
+endif
 
 EXTRA_DIST = certs conf exc misc server test README $(TESTS) $(XFAIL_TESTS)