Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.4KB

  1. # =============================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_python_module_version.html
  3. # =============================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PYTHON_MODULE_VERSION(modname, min_version[, python])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Checks for Python module with at least the given version.
  12. #
  13. # Triggers an error if module is absent or present but at a lower version.
  14. # The third parameter can either be "python" for Python 2 or "python3" for
  15. # Python 3; defaults to Python 3.
  16. #
  17. # LICENSE
  18. #
  19. # Copyright (c) 2015 Endless Mobile, Inc.; contributed by Philip Chimento <philip@endlessm.com> and Kurt von Laven <kurt@endlessm.com>
  20. #
  21. # Copying and distribution of this file, with or without modification, are
  22. # permitted in any medium without royalty provided the copyright notice
  23. # and this notice are preserved. This file is offered as-is, without any
  24. # warranty.
  25. #serial 3
  26. AC_DEFUN([AX_PYTHON_MODULE_VERSION], [
  27. AX_PYTHON_MODULE([$1], [required], [$3])
  28. AC_MSG_CHECKING([for version $2 or higher of $1])
  29. $PYTHON -c "import sys, $1; from distutils.version import StrictVersion; sys.exit(StrictVersion($1.__version__) < StrictVersion('$2'))" 2> /dev/null
  30. AS_IF([test $? -eq 0], [], [
  31. AC_MSG_RESULT([no])
  32. AC_MSG_ERROR([You need at least version $2 of the $1 Python module.])
  33. ])
  34. AC_MSG_RESULT([yes])
  35. ])