#dist_bashcompletion_DATA =
EXTRA_DIST = \
-autoconf-archive/ax_python_module.m4 \
+autoconf-archive/ax_check_python_modules.m4 \
autoconf-archive/ax_prog_python_version.m4 \
autoconf-archive/ax_compare_version.m4 \
NEWS README COPYING ChangeLog \
--- /dev/null
+# -*- Autoconf -*-
+#
+# ax_check_python_modules.m4 - Macros to locate python modules.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+#
+# Author: Dodji Seketeli <dodji@seketeli.org>
+#
+
+#--------------------------------------------------------------------------------
+#
+# SYNOPSIS
+#
+# AX_CHECK_PYTHON_MODULE(MODNAME,
+# PYTHON,
+# ACTION-IF-FOUND,
+# ACTION-IF-NOT-FOUND)
+#
+# DESCRIPTION
+#
+# Check that a python module is present on the system.
+#
+# MODNAME is the name of the python module to check for.
+#
+# PYTHON is either python2 or python3. It's the python interpreter
+# to use. By default, this is python3.
+#
+# If the module MODNAME is found, the shell variable
+# HAVE_PYMOD_MODNAME is set to 'yes' and ACTION-IF_FOUND is
+# evaluated. Otherwise the shell variable HAVE_PYMOD_MODNAME is set
+# to 'no' and ACTION-IF-NOT-FOUND is evaluated.
+#
+# Note that this macro was inspired from the ax_python_module.m4
+# at
+# http://www.gnu.org/software/autoconf-archive/ax_python_module.html.
+#
+#----------------------------------------------------------------------------------
+AU_ALIAS([AC_CHECK_PYTHON_MODULE], [AX_CHECK_PYTHON_MODULE])
+AC_DEFUN([AX_CHECK_PYTHON_MODULE],[
+ if test -z $PYTHON; then
+ if test -z "$2"; then
+ PYTHON="python3"
+ else
+ PYTHON="$2"
+ fi
+ fi
+ PYTHON_NAME=`basename $PYTHON`
+ AC_MSG_CHECKING($PYTHON_NAME module: $1)
+ $PYTHON -c "import $1" 2>/dev/null
+ if test $? -eq 0; then
+ AC_MSG_RESULT(yes)
+ eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
+ $3
+ #
+ else
+ AC_MSG_RESULT(no)
+ eval AS_TR_CPP(HAVE_PYMOD_$1)=no
+ $4
+ #
+ fi
+])
+
+#--------------------------------------------------------------------------------
+#
+# SYNOPSIS
+#
+# AX_CHECK_PYTHON_MODULES(MODLIST,
+# PYTHON,
+# ACTION-IF-FOUND,
+# ACTION-IF-NOT-FOUND)
+#
+# DESCRIPTION
+#
+# Checks that a set of Python modules are present on the system.
+#
+# MODLIST is a white space separated list of python modules to check
+# for.
+#
+# PYTHON is either python2 or python3. It's the name of the python
+# interpreter to use to perform the checking. By default, uses
+# python3.
+#
+# If there is a module from MODLIST that is not found the execution
+# of the test stops and ACTION-IF-NOT-FOUND is evaluated.
+# Otherwise, if all modules are found, ACTION-IF-FOUND is evaluated.
+#
+#--------------------------------------------------------------------------------
+AU_ALIAS([AC_CHECK_PYTHON_MODULES], [AX_CHECK_PYTHON_MODULES])
+AC_DEFUN([AX_CHECK_PYTHON_MODULES], [
+ ax_python_modules_are_ok__=yes
+ for m in $1; do
+ AX_CHECK_PYTHON_MODULE([$m],
+ $2,
+ [ax_python_module_FOUND__=yes],
+ [ax_python_module_FOUND__=no])
+ if test x$ax_python_module_FOUND__ = xno; then
+ MISSING_PYTHON_MODULES="$MISSING_PYTHON_MODULES $m"
+ ax_python_modules_are_ok__=no
+ fi
+ done
+
+ if test x$ax_python_modules_are_ok__ = xyes; then
+ $3
+ #
+ else
+ $4
+ #
+ fi
+])
+++ /dev/null
-# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_python_module.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_PYTHON_MODULE(modname[, fatal, python])
-#
-# DESCRIPTION
-#
-# Checks for Python module.
-#
-# If fatal is non-empty then absence of a module will trigger an error.
-# The third parameter can either be "python" for Python 2 or "python3" for
-# Python 3; defaults to Python 3.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Andrew Collier
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 8
-
-AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
-AC_DEFUN([AX_PYTHON_MODULE],[
- if test -z $PYTHON;
- then
- if test -z "$3";
- then
- PYTHON="python3"
- else
- PYTHON="$3"
- fi
- fi
- PYTHON_NAME=`basename $PYTHON`
- AC_MSG_CHECKING($PYTHON_NAME module: $1)
- $PYTHON -c "import $1" 2>/dev/null
- if test $? -eq 0;
- then
- AC_MSG_RESULT(yes)
- eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
- else
- AC_MSG_RESULT(no)
- eval AS_TR_CPP(HAVE_PYMOD_$1)=no
- #
- if test -n "$2"
- then
- AC_MSG_ERROR(failed to find required module $1)
- exit 1
- fi
- fi
-])
dnl These macros are coming from the autoconf archive at
dnl http://www.gnu.org/software/autoconf-archive
-dnl This one is for the AX_PYTHON_MODULE() macro.
-m4_include([autoconf-archive/ax_python_module.m4])
+dnl This one is for the AX_CHECK_PYTHON_MODULES() macro.
+m4_include([autoconf-archive/ax_check_python_modules.m4])
dnl These two below are for the AX_PROG_PYTHON_VERSION() module.
m4_include([autoconf-archive/ax_compare_version.m4])
AC_MSG_ERROR([could not find a python program of version at least $MINIMAL_PYTHON_VERSION])
fi
- AX_PYTHON_MODULE(argparse, $FATAL, python2)
- AX_PYTHON_MODULE(glob, $FATAL, python2)
- AX_PYTHON_MODULE(logging, $FATAL, python2)
- AX_PYTHON_MODULE(os, $FATAL, python2)
- AX_PYTHON_MODULE(re, $FATAL, python2)
- AX_PYTHON_MODULE(subprocess, $FATAL, python2)
- AX_PYTHON_MODULE(sys, $FATAL, python2)
- AX_PYTHON_MODULE(itertools, $FATAL, python2)
- AX_PYTHON_MODULE(urlparse, $FATAL, python2)
- AX_PYTHON_MODULE(itertools, $FATAL, python2)
- AX_PYTHON_MODULE(unittest, $FATAL, python2)
- AX_PYTHON_MODULE(xdg, $FATAL, python2)
- AX_PYTHON_MODULE(koji, $FATAL, python2)
- AX_PYTHON_MODULE(mock, $FATAL, python2)
- AX_PYTHON_MODULE(StringIO, $FATAL, python2)
- ENABLE_FEDABIPKGDIFF=yes
-
- if test x$ENABLE_FEDABIPKGDIFF != xyes; then
- ENABLE_FEDABIPKGDIFF=no
+ REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF="\
+ argparse logging os re subprocess sys itertools urlparse \
+ unittest xdg koji mock StringIO"
+
+ if test -x$ENABLE_FEDABIPKGDIFF != xno; then
+ AX_CHECK_PYTHON_MODULES([$REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF],
+ [python2],
+ [FOUND_ALL_PYTHON_MODULES=yes],
+ [FOUND_ALL_PYTHON_MODULES=no])
+
+ if test x$FOUND_ALL_PYTHON_MODULES = xno; then
+ AC_MSG_NOTICE([missing python modules: $MISSING_PYTHON_MODULES])
+ AC_MSG_NOTICE([disabling fedabipkgdiff as a result])
+ ENABLE_FEDABIPKGDIFF=no
+ else
+ ENABLE_FEDABIPKGDIFF=yes
+ fi
fi
fi