| 1 | # check_tappy.m4 -- check for tappy Python package |
| 2 | # |
| 3 | # Copyright (C) 2015 - Philippe Proulx <pproulx@efficios.com> |
| 4 | # |
| 5 | # This file is free software; the Free Software Foundation gives |
| 6 | # unlimited permission to copy and/or distribute it, with or without |
| 7 | # modifications, as long as this notice is preserved. |
| 8 | |
| 9 | # Sphinx ships with a script named "sphinx-build", which is usually |
| 10 | # installed in "/usr/bin". Unfortunately, this script uses |
| 11 | # "/usr/bin/python" as its interpreter. Since "/usr/bin/python" can |
| 12 | # be either Python 2 or Python 3, depending on the distribution, and |
| 13 | # since we absolutely need the Python 3 Sphinx package for Babeltrace |
| 14 | # because it needs to import our bindings for autodocumentation, |
| 15 | # there's no way to tell if "sphinx-build" is actually using Python 2 |
| 16 | # or Python 3. |
| 17 | # |
| 18 | # This macro checks if the Sphinx package ("sphinx") is installed |
| 19 | # and visible from the interpreter designated by the PYTHON variable. |
| 20 | # It sets PYTHON_SPHINX_EXISTS to "yes" if Sphinx is found for the |
| 21 | # given Python interpreter, otherwise "no". |
| 22 | |
| 23 | # AM_CHECK_PYTHON_SPHINX(PYTHON) |
| 24 | # --------------------------------------------------------------------------- |
| 25 | AC_DEFUN([AM_CHECK_PYTHON_TAPPY], |
| 26 | [prog=" |
| 27 | try: |
| 28 | from tap import TAPTestRunner |
| 29 | print('yes') |
| 30 | except ImportError: |
| 31 | print('no')" |
| 32 | PYTHON_TAPPY_EXISTS=`${$1} -c "$prog"`]) |